public async Task Create(FamiliaPuestosSind model) { try { _db.familiasPuestosSind.Add(model); await _db.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <IHttpActionResult> Update(FamiliaPuestosSind datos) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.Update(datos); return(Ok("Nivel de competencia actualizado correctamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
[HttpPost][Authorize] public async Task <IHttpActionResult> Create(FamiliaPuestosSind datos) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _repository.Create(datos); return(Ok("Nivel de competencia asignado correctamente a la categoría")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
public async Task UpdateEstado(FamiliaPuestosSind obj) { try { var _obj = await _db.familiasPuestosSind.FirstOrDefaultAsync(e => e.FamiliaId == obj.FamiliaId); if (_obj != null) { _obj.estado = obj.estado; await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task Update(FamiliaPuestosSind model) { try { var _model = await _db.familiasPuestosSind.FirstOrDefaultAsync(e => e.FamiliaId == model.FamiliaId); if (_model != null) { _db.Entry(_model).CurrentValues.SetValues(model); await _db.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }