public async Task Create(TipoSoftware model) { try { _db.dbSetCAT_TipoSoftware.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task UpdateEstado(TipoSoftware model) { try { var _model = await _db.dbSetCAT_TipoSoftware.FirstOrDefaultAsync(e => e.TipoSoftwareId == model.TipoSoftwareId); if (_model != null) { _model.Estado = model.Estado; await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <IHttpActionResult> UpdateEstado(TipoSoftware model) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _entityRepo.UpdateEstado(model); return(Ok("Registro actualizado exitosamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
[Authorize] public async Task <IHttpActionResult> Create([FromBody] TipoSoftware model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _entityRepo.Create(model); return(Ok("Registro creado exitosamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }