public IActionResult set([FromBody] Negocio negocio) { try { #region Validaciones if (ClUsuario.ChecarUsuario(negocio.IdUsuario) == null) { return(StatusCode(400, new { Error = true, Catch = "El Usuario no existe" })); } if (ClEstado.ChecarEstado(negocio.IdEstado) == null) { return(StatusCode(400, new { Error = true, Catch = "El Estado no existe" })); } if (CLMunicipio.ChecarMunicipio(negocio.IdMunicipio) == null) { return(StatusCode(400, new { Error = true, Catch = "El Municipio no existe" })); } if (CLImagen.ChecarImagen(negocio.IdImagen) == null) { return(StatusCode(400, new { Error = true, Catch = "La Imagen no existe" })); } if (negocio.Nombre == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "El nombre debe ser necesario" })); } if (negocio.RazonSocial == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "La Razon Social debe ser necesario" })); } if (negocio.Calle == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "La calle debe ser necesario" })); } if (negocio.Colonia == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "La colonia debe ser necesario" })); } if (negocio.NumeroInterior == 0) { return(StatusCode(400, new { Error = true, Catch = "El numero interior debe ser necesario" })); } #endregion return(StatusCode(200, new { Error = false, Negocios = ClNegocio.set(negocio) })); } catch (Exception ex) { return(StatusCode(500, new { Error = true, Catch = ex.Message, Catch2 = ex.InnerException })); } }
public IActionResult set([FromBody] Direccion direccion) { try { #region Validacion /*if (direccion.IdDireccion == null) { * return StatusCode(400, new * { * Error = true, * Catch = "El IdDireccion debe de ser defenido" * }); * }*/ if (CLUsuario.ChecarUsuario(direccion.IdUsuario) == null) { return(StatusCode(400, new { Error = true, Catch = "El Usuario no existe" })); } if (ClEstado.ChecarEstado(direccion.IdEstado) == null) { return(StatusCode(400, new { Error = true, Catch = "El Estado no existe" })); } if (ClMunicipio.ChecarMunicipio(direccion.IdMunicipio) == null) { return(StatusCode(400, new { Error = true, Catch = "El Municipio no existe" })); } if (direccion.Colonia == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "La Colonia es necesaria" })); } if (direccion.Calle == String.Empty) { return(StatusCode(400, new { Error = true, Catch = "La Calle es necesaria" })); } if (direccion.NumeroInterior == 0) { return(StatusCode(400, new { Error = true, Catch = "El Numero interior debe de ser mayor" })); } #endregion return(StatusCode(200, new { Error = false, Direccion = ClDireccion.set(direccion) })); } catch (Exception ex) { return(StatusCode(500, new { Error = true, Catch = ex.Message, Catch2 = ex.InnerException })); } }