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