Skip to content
Snippets Groups Projects

Fix multi tenant

Merged Enzo Santangelo Dodera requested to merge fix-Multi-Tenant into master
19 files
+ 388
79
Compare changes
  • Side-by-side
  • Inline
Files
19
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Tsi1.BusinessLayer.Dtos;
using Tsi1.BusinessLayer.Helpers;
using Tsi1.BusinessLayer.Interfaces;
namespace Tsi1.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TenantController : ControllerBase
{
private readonly ITenantService _tenantService;
public TenantController(ITenantService tenantService)
{
_tenantService = tenantService;
}
[Authorize(Roles = UserTypes.UdelarAdmin)]
[HttpGet("GetAll")]
public async Task<IActionResult> GetAll()
{
var result = await _tenantService.GetAll();
if (result.HasError)
{
return BadRequest(result.Message);
}
return Ok(result.Data);
}
[Authorize(Roles = UserTypes.UdelarAdmin)]
[HttpPost("Create")]
public async Task<IActionResult> Create(TenantCreateDto newTenant)
{
var result = await _tenantService.Create(newTenant);
if (result.HasError)
{
return BadRequest(result.Message);
}
return Ok(result.Data);
}
}
}
Loading