Refactor code formatting
This commit is contained in:
@@ -12,12 +12,15 @@ using Modelo;
|
|||||||
|
|
||||||
namespace AlquilaFacil.Controllers;
|
namespace AlquilaFacil.Controllers;
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class VentaController:ControllerBase {
|
public class VentaController : ControllerBase
|
||||||
|
{
|
||||||
|
|
||||||
[HttpPost("api/venta/AceptarConsultaVenta")]
|
[HttpPost("api/venta/AceptarConsultaVenta")]
|
||||||
public IActionResult AceptarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
public IActionResult AceptarConsultaVenta([FromHeader(Name = "Auth")] string Auth, NotificacionMarcarLeidoDto dto)
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
{
|
||||||
if (validacion1 == false) {
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 15);
|
||||||
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email" });
|
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email" });
|
||||||
@@ -32,7 +35,8 @@ public class VentaController:ControllerBase {
|
|||||||
|
|
||||||
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(n.Idpropiedad);
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(n.Idpropiedad);
|
||||||
if (prop == null) return BadRequest(new { message = "No se encuentra una propiedad por ese id" });
|
if (prop == null) return BadRequest(new { message = "No se encuentra una propiedad por ese id" });
|
||||||
Venta? v = new Venta{
|
Venta? v = new Venta
|
||||||
|
{
|
||||||
Fechainicio = DateTime.Now,
|
Fechainicio = DateTime.Now,
|
||||||
IdVendedor = prop.Dnipropietario,
|
IdVendedor = prop.Dnipropietario,
|
||||||
IdComprador = n.Dniremitente,
|
IdComprador = n.Dniremitente,
|
||||||
@@ -44,7 +48,8 @@ public class VentaController:ControllerBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool ret = RepositorioVentas.Singleton.IniciarVenta(v, cli.Dni);
|
bool ret = RepositorioVentas.Singleton.IniciarVenta(v, cli.Dni);
|
||||||
if (ret){
|
if (ret)
|
||||||
|
{
|
||||||
var noti = new NotificacioneBuilder()
|
var noti = new NotificacioneBuilder()
|
||||||
.SetAccion("Notificacion")
|
.SetAccion("Notificacion")
|
||||||
.SetMensaje("Debe Realizar el pago para que se registre el traspaso de la propiedad")
|
.SetMensaje("Debe Realizar el pago para que se registre el traspaso de la propiedad")
|
||||||
@@ -61,9 +66,11 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("api/venta/CancelarConsultaVenta")]
|
[HttpPost("api/venta/CancelarConsultaVenta")]
|
||||||
public IActionResult CancelarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
public IActionResult CancelarConsultaVenta([FromHeader(Name = "Auth")] string Auth, NotificacionMarcarLeidoDto dto)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,9 +98,11 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/propiedad/EstaALaVenta")]
|
[HttpGet("/api/propiedad/EstaALaVenta")]
|
||||||
public IActionResult EstaALaVenta([FromHeader(Name="Auth")]string Auth, int idprop=0) {
|
public IActionResult EstaALaVenta([FromHeader(Name = "Auth")] string Auth, int idprop = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
if (idprop <= 0) return BadRequest(new { message = "No hay propiedades con id 0 o menor" });
|
if (idprop <= 0) return BadRequest(new { message = "No hay propiedades con id 0 o menor" });
|
||||||
@@ -104,9 +113,11 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("/api/propiedad/setPropiedadAVenta")]
|
[HttpPut("/api/propiedad/setPropiedadAVenta")]
|
||||||
public IActionResult setPropiedadAVenta([FromHeader(Name="Auth")]string Auth, SetVentaDto dto) {
|
public IActionResult setPropiedadAVenta([FromHeader(Name = "Auth")] string Auth, SetVentaDto dto)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,9 +139,11 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("/api/propiedad/unsetPropiedadAVenta")]
|
[HttpPut("/api/propiedad/unsetPropiedadAVenta")]
|
||||||
public IActionResult unsetPropiedadAVenta([FromHeader(Name="Auth")]string Auth, SetVentaDto dto) {
|
public IActionResult unsetPropiedadAVenta([FromHeader(Name = "Auth")] string Auth, SetVentaDto dto)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,9 +167,11 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("/api/ventas/ejercerOpcionVenta")]
|
[HttpPost("/api/ventas/ejercerOpcionVenta")]
|
||||||
public IActionResult EjercerOpcionVenta([FromHeader(Name="Auth")]string Auth, [FromQuery]long idcontrato=0) {
|
public IActionResult EjercerOpcionVenta([FromHeader(Name = "Auth")] string Auth, [FromQuery] long idcontrato = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
if (idcontrato <= 0) return BadRequest(new { message = "No pueden hacer cotratos con id 0 o menor" });
|
if (idcontrato <= 0) return BadRequest(new { message = "No pueden hacer cotratos con id 0 o menor" });
|
||||||
@@ -183,12 +198,15 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("/api/ventas/subirReciboPago")]
|
[HttpPost("/api/ventas/subirReciboPago")]
|
||||||
public async Task<IActionResult> SubirRecibo([FromHeader(Name="Auth")]string Auth, IFormFile file, long idventa ) {
|
public async Task<IActionResult> SubirRecibo([FromHeader(Name = "Auth")] string Auth, IFormFile file, long idventa)
|
||||||
|
{
|
||||||
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,9 +236,11 @@ public class VentaController:ControllerBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
private readonly IMinioClient mc;
|
private readonly IMinioClient mc;
|
||||||
public VentaController(IMinioClient minioClient) {
|
public VentaController(IMinioClient minioClient)
|
||||||
|
{
|
||||||
mc = minioClient;
|
mc = minioClient;
|
||||||
if (mc == null){
|
if (mc == null)
|
||||||
|
{
|
||||||
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(System.IO.File.ReadAllText("./settings.json")) ?? null;
|
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(System.IO.File.ReadAllText("./settings.json")) ?? null;
|
||||||
if (mcon == null) throw new Exception();
|
if (mcon == null) throw new Exception();
|
||||||
|
|
||||||
@@ -230,16 +250,20 @@ public class VentaController:ControllerBase {
|
|||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private async Task<bool> subirContrato(IFormFile f, string flname) {
|
private async Task<bool> subirContrato(IFormFile f, string flname)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
var buck = new BucketExistsArgs().WithBucket("alquilafacil");
|
var buck = new BucketExistsArgs().WithBucket("alquilafacil");
|
||||||
bool encontrado = await mc.BucketExistsAsync(buck).ConfigureAwait(false);
|
bool encontrado = await mc.BucketExistsAsync(buck).ConfigureAwait(false);
|
||||||
|
|
||||||
if(!encontrado){
|
if (!encontrado)
|
||||||
|
{
|
||||||
var mb = new MakeBucketArgs().WithBucket("alquilafacil");
|
var mb = new MakeBucketArgs().WithBucket("alquilafacil");
|
||||||
await mc.MakeBucketAsync(mb).ConfigureAwait(false);
|
await mc.MakeBucketAsync(mb).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
using (var stream = new MemoryStream()){
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
await f.CopyToAsync(stream);
|
await f.CopyToAsync(stream);
|
||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
PutObjectArgs putbj = new PutObjectArgs()
|
PutObjectArgs putbj = new PutObjectArgs()
|
||||||
@@ -251,18 +275,23 @@ public class VentaController:ControllerBase {
|
|||||||
await mc.PutObjectAsync(putbj);
|
await mc.PutObjectAsync(putbj);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e ) {
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
Console.Error.WriteLine(e.Message);
|
Console.Error.WriteLine(e.Message);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/ventas/verRecibo")]
|
[HttpGet("/api/ventas/verRecibo")]
|
||||||
public IActionResult verRecibo([FromHeader(Name="Auth")]string Auth, long idventa=0){
|
public IActionResult verRecibo([FromHeader(Name = "Auth")] string Auth, long idventa = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,13 +304,15 @@ public class VentaController:ControllerBase {
|
|||||||
if (venta == null) return BadRequest(new { message = "no hay una venta con esa id" });
|
if (venta == null) return BadRequest(new { message = "no hay una venta con esa id" });
|
||||||
if (cli.Dni != venta.IdComprador && cli.Dni != venta.IdVendedor) return Unauthorized();
|
if (cli.Dni != venta.IdComprador && cli.Dni != venta.IdVendedor) return Unauthorized();
|
||||||
|
|
||||||
try{
|
try
|
||||||
|
{
|
||||||
var memstream = new MemoryStream();
|
var memstream = new MemoryStream();
|
||||||
|
|
||||||
var goa = new GetObjectArgs()
|
var goa = new GetObjectArgs()
|
||||||
.WithBucket("alquilafacil")
|
.WithBucket("alquilafacil")
|
||||||
.WithObject(venta.UrlRecibo)
|
.WithObject(venta.UrlRecibo)
|
||||||
.WithCallbackStream(stream => {
|
.WithCallbackStream(stream =>
|
||||||
|
{
|
||||||
memstream.Position = 0;
|
memstream.Position = 0;
|
||||||
stream.CopyTo(memstream);
|
stream.CopyTo(memstream);
|
||||||
});
|
});
|
||||||
@@ -293,7 +324,9 @@ public class VentaController:ControllerBase {
|
|||||||
|
|
||||||
return File(memstream, "application/pdf", venta.UrlRecibo);
|
return File(memstream, "application/pdf", venta.UrlRecibo);
|
||||||
|
|
||||||
} catch (Exception e){
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
Console.Error.WriteLine(e);
|
Console.Error.WriteLine(e);
|
||||||
return BadRequest(new { message = "Fallo al intentar obtener el archivo del almacenamiento o este no existe" });
|
return BadRequest(new { message = "Fallo al intentar obtener el archivo del almacenamiento o este no existe" });
|
||||||
}
|
}
|
||||||
@@ -301,11 +334,14 @@ public class VentaController:ControllerBase {
|
|||||||
|
|
||||||
|
|
||||||
[HttpPost("/api/ventas/propietarioverifica")]
|
[HttpPost("/api/ventas/propietarioverifica")]
|
||||||
public IActionResult PropietarioVerifica([FromHeader(Name="Auth")]string Auth, long idventa=0) {
|
public IActionResult PropietarioVerifica([FromHeader(Name = "Auth")] string Auth, long idventa = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,11 +360,14 @@ public class VentaController:ControllerBase {
|
|||||||
|
|
||||||
|
|
||||||
[HttpGet("/api/venta")]
|
[HttpGet("/api/venta")]
|
||||||
public IActionResult ObtenerVenta([FromHeader(Name="Auth")]string Auth, long idventa=0) {
|
public IActionResult ObtenerVenta([FromHeader(Name = "Auth")] string Auth, long idventa = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,16 +392,23 @@ public class VentaController:ControllerBase {
|
|||||||
.SetEstado(ventas.IdestadoNavigation.Descripcion ?? "")
|
.SetEstado(ventas.IdestadoNavigation.Descripcion ?? "")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
return Ok(new { data = v, iscomprador = (ventas.IdComprador==cli.Dni)?true:false,
|
return Ok(new
|
||||||
necesitaRecibo = ventas.UrlRecibo==null?true:false});
|
{
|
||||||
|
data = v,
|
||||||
|
iscomprador = (ventas.IdComprador == cli.Dni) ? true : false,
|
||||||
|
necesitaRecibo = ventas.UrlRecibo == null ? true : false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/ventas")]
|
[HttpGet("/api/ventas")]
|
||||||
public IActionResult ObtenerVentas([FromHeader(Name="Auth")]string Auth) {
|
public IActionResult ObtenerVentas([FromHeader(Name = "Auth")] string Auth)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -374,7 +420,8 @@ public class VentaController:ControllerBase {
|
|||||||
if (ventas == null) return BadRequest(new { message = "no estas involucrado en ninguna venta o compra" });
|
if (ventas == null) return BadRequest(new { message = "no estas involucrado en ninguna venta o compra" });
|
||||||
|
|
||||||
List<VentasDto> lista = new();
|
List<VentasDto> lista = new();
|
||||||
foreach (var i in ventas) {
|
foreach (var i in ventas)
|
||||||
|
{
|
||||||
var v = new VentasDtoBuilder()
|
var v = new VentasDtoBuilder()
|
||||||
.SetId(i.Id)
|
.SetId(i.Id)
|
||||||
.SetMonto(i.Monto)
|
.SetMonto(i.Monto)
|
||||||
@@ -392,11 +439,14 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/opcionventa")]
|
[HttpGet("/api/opcionventa")]
|
||||||
public IActionResult ObtenerDto([FromHeader(Name="Auth")]string Auth, long idcontrato=0) {
|
public IActionResult ObtenerDto([FromHeader(Name = "Auth")] string Auth, long idcontrato = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,16 +469,21 @@ public class VentaController:ControllerBase {
|
|||||||
return Ok(dto);
|
return Ok(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool puedeEjercer(Contrato c) {
|
private bool puedeEjercer(Contrato c)
|
||||||
|
{
|
||||||
bool ret = c.Idcanons.All(x => x.Pagado == 1);
|
bool ret = c.Idcanons.All(x => x.Pagado == 1);
|
||||||
|
|
||||||
if (ret) {
|
if (ret)
|
||||||
|
{
|
||||||
var canonConFechaMasTardia = c.Idcanons.OrderByDescending(x => x.Fecha).FirstOrDefault();
|
var canonConFechaMasTardia = c.Idcanons.OrderByDescending(x => x.Fecha).FirstOrDefault();
|
||||||
|
|
||||||
if (canonConFechaMasTardia != null && canonConFechaMasTardia.Fecha.Year >= DateTime.Now.Year
|
if (canonConFechaMasTardia != null && canonConFechaMasTardia.Fecha.Year >= DateTime.Now.Year
|
||||||
&& canonConFechaMasTardia.Fecha.Month >= DateTime.Now.Month) {
|
&& canonConFechaMasTardia.Fecha.Month >= DateTime.Now.Month)
|
||||||
|
{
|
||||||
ret = true;
|
ret = true;
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,11 +492,14 @@ public class VentaController:ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("/api/contrato/tieneopcionventa")]
|
[HttpGet("/api/contrato/tieneopcionventa")]
|
||||||
public IActionResult TieneOpcionVenta([FromHeader(Name="Auth")]string Auth, long idcontrato=0) {
|
public IActionResult TieneOpcionVenta([FromHeader(Name = "Auth")] string Auth, long idcontrato = 0)
|
||||||
|
{
|
||||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
if (validacion1 == false){
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
if (validacion1 == false) {
|
if (validacion1 == false)
|
||||||
|
{
|
||||||
return Unauthorized();
|
return Unauthorized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user