public async Task<IHttpActionResult> Update(RelacionCategoriasTecnicas obj) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.Update(obj); return Ok("Estado de evaluación actualizado correctamente!"); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return InternalServerError(e); } }
[HttpPost][Authorize] public async Task<IHttpActionResult> Create(RelacionCategoriasTecnicas obj) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.Create(obj); return Ok("Categoría de evaluación creado correctamente!"); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return InternalServerError(e); } }
public async Task Create(RelacionCategoriasTecnicas model) { try { _db.categoriasTecnicas.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task UpdateEstado(RelacionCategoriasTecnicas obj) { try { var _obj = await _db.categoriasTecnicas.FirstOrDefaultAsync(e => e.Id == obj.Id); if (_obj != null) { _obj.Estado = obj.Estado; await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task Update(RelacionCategoriasTecnicas model) { try { var _model = await _db.categoriasTecnicas.FirstOrDefaultAsync(e => e.Id == model.Id); if (_model != null) { _db.Entry(_model).CurrentValues.SetValues(model); await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }