Пример #1
0
 public async Task Create(Iniciativas Iniciativas)
 {
     try
     {
         _ctx.dbSetIniciativa.Add(Iniciativas);
         await _ctx.SaveChangesAsync();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message, e);
     }
 }
Пример #2
0
        public async Task Update(Iniciativas iniciativa)
        {
            try
            {
                var _iniciativaEmpresa = await _ctx.dbSetIniciativa
                                         .FirstOrDefaultAsync(c => c.FolioId == iniciativa.FolioId);

                if (_iniciativaEmpresa != null)
                {
                    _ctx.Entry(_iniciativaEmpresa).CurrentValues.SetValues(iniciativa);
                    await _ctx.SaveChangesAsync();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message, e);
            }
        }
Пример #3
0
                                                         public async Task <IHttpActionResult> Delete(Iniciativas iniciativa)
                                                         {
                                                             try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                   await _iniciativasRepo.Delete(iniciativa);

                                                                   return(Ok("Se ha eliminado la iniciativa de la empresa correctamente!")); }
                                                             catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                                                                                   return(InternalServerError(e)); }
                                                         }
Пример #4
0
                                                         [Authorize] public async Task <IHttpActionResult> CreateIniciativaEmpresa(Iniciativas iniciativa)
                                                         {
                                                             try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                   await _iniciativasRepo.AsignarIniciativa(iniciativa);

                                                                   return(Ok("Se ha asignado correctamente!")); }
                                                             catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);

                                                                                   return(InternalServerError(e)); }
                                                         }
Пример #5
0
                                                         public async Task <IHttpActionResult> UpdateIniciativa(Iniciativas iniciativa)
                                                         {
                                                             try { log.Info(new MDCSet(this.ControllerContext.RouteData));
                                                                   await _iniciativasRepo.Update(iniciativa);

                                                                   return(Ok("Se ha actualizado correctamente!")); }
                                                             catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);
                                                                                   return(InternalServerError(e)); }
                                                         }