public async Task Create(CalificacionCompetencias model) { try { _db.calificacion.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task Update(CalificacionCompetencias model) { try { var _model = await _db.calificacion.FirstOrDefaultAsync(e => e.calificacion == model.calificacion); if (_model != null) { _db.Entry(_model).CurrentValues.SetValues(model); await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task UpdateEstado(CalificacionCompetencias obj) { try { var _obj = await _db.calificacion.FirstOrDefaultAsync(e => e.CalificacionId == obj.CalificacionId); if (_obj != null) { _obj.estado = obj.estado; await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <IHttpActionResult> UpdateEstado(CalificacionCompetencias obj) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.UpdateEstado(obj); return(Ok("Registro actualizado correctamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
[HttpPost][Authorize] public async Task <IHttpActionResult> Create(CalificacionCompetencias obj) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.Create(obj); return(Ok("Calificación creada correctamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }