public ResponseViewModel UptadeNotificacion(NotificacionesViewModel model)
        {
            ResponseViewModel reponse = new ResponseViewModel();

            try
            {
                var notiExi = _eventPlusContext.Notificaciones.Where(w => w.Id == model.Id).FirstOrDefault();

                if (notiExi == null)
                {
                    reponse.Type     = "error";
                    reponse.Response = "La notificación no existe ";
                    return(reponse);
                }
                notiExi.Entregado = "1";

                _eventPlusContext.Notificaciones.Add(notiExi);
                _eventPlusContext.Entry(notiExi).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                _eventPlusContext.SaveChanges();

                reponse.Type     = "success";
                reponse.Response = "El regitsro se ha actulizado.";

                return(reponse);
            }
            catch (Exception ex)
            {
                reponse.Type     = "error";
                reponse.Response = "Error en el procedimiento. ---> " + ex.Message;
                return(reponse);
            }
        }
        public ResponseViewModel CreateNotificacion(NotificacionesViewModel model)
        {
            ResponseViewModel reponse = new ResponseViewModel();

            try
            {
                Notificaciones noti = new Notificaciones
                {
                    Entregado     = "0",
                    Mensaje       = model.Mensaje,
                    Titulo        = model.Titulo,
                    IdLogin       = model.IdLogin,
                    Activo        = "1",
                    FechaRegistro = DateTime.Now
                };
                _eventPlusContext.Notificaciones.Add(noti);
                _eventPlusContext.SaveChanges();

                reponse.Type     = "success";
                reponse.Response = "El regitsro se creó exitosamente.";

                return(reponse);
            }
            catch (Exception ex)
            {
                reponse.Type     = "error";
                reponse.Response = "Error en el procedimiento. ---> " + ex.Message;
                return(reponse);
            }
        }
        public NotificacionesPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new NotificacionesViewModel();
        }
Beispiel #4
0
        public IActionResult UptadeNotificacion([FromBody] NotificacionesViewModel model)
        {
            var user = _publicacionesService.UptadeNotificacion(model);

            return(Ok(user));
        }
Beispiel #5
0
        public IActionResult CreateNotificacion([FromBody] NotificacionesViewModel model)
        {
            var noti = _publicacionesService.CreateNotificacion(model);

            return(Ok(noti));
        }