public async Task <RespuestaDatos> RemoverNotificacion(int idNotificacion) { using FeContext context = new FeContext(); RespuestaDatos respuestaDatos; NotificacionesCor notificacion = GetNotificacionPorIdNotificacion(idNotificacion); if (notificacion != null) { try { context.Attach(notificacion); notificacion.Estado = COEstados.INACTIVO; context.SaveChanges(); respuestaDatos = new RespuestaDatos { Codigo = COCodigoRespuesta.OK, Mensaje = "Notificación eliminada exitosamente." }; } catch (Exception e) { throw new COExcepcion("Ocurrió un problema al intentar eliminar la notificación."); } } else { throw new COExcepcion("La notificación no existe"); } return(respuestaDatos); }
public async Task <RespuestaDatos> GuardarNotificacion(NotificacionesCor notificacion) { RespuestaDatos respuestaDatos; try { DemografiaCor demografiaCor = GetDemografiaPorId(notificacion.Idusuario); respuestaDatos = respuestaDatos = await _cOGeneralBiz.GuardarNotificacion(notificacion, demografiaCor); } catch (COExcepcion e) { throw e; } return(respuestaDatos); }
public async Task <RespuestaDatos> GuardarNotificacion([FromBody] NotificacionesCor notificacion) { RespuestaDatos respuestaDatos; try { respuestaDatos = await _cOGeneralFachada.GuardarNotificacion(notificacion); } catch (COExcepcion e) { respuestaDatos = new RespuestaDatos { Codigo = COCodigoRespuesta.ERROR, Mensaje = e.Message }; } return(respuestaDatos); }
internal async Task <RespuestaDatos> GuardarNotificacion(NotificacionesCor notificacion, DemografiaCor demografia) { RespuestaDatos respuestaDatos; if (demografia != null) { try { respuestaDatos = await _repoNotificacion.GuardarNotificacion(notificacion); } catch (COExcepcion e) { throw e; } } else { throw new COExcepcion("El usuario ingresado no existe."); } return(respuestaDatos); }
public async Task <RespuestaDatos> GuardarNotificacion(NotificacionesCor notificacion) { using FeContext context = new FeContext(); RespuestaDatos respuestaDatos; try { notificacion.Creacion = DateTime.Now; notificacion.Estado = COEstados.VIGENTE; context.Add(notificacion); context.SaveChanges(); respuestaDatos = new RespuestaDatos { Codigo = COCodigoRespuesta.OK, Mensaje = "Notificación creada exitosamente." }; } catch (Exception e) { throw new COExcepcion("Ocurrió un problema al intentar agregar la notificacion."); } return(respuestaDatos); }