//Crear nivel curso public async Task Create(NivelSNI NivelSNI) { try { _ctx.NivelSNI.Add(NivelSNI); await _ctx.SaveChangesAsync(); } catch (Exception e) { throw new Exception(e.Message, e); } }
//Actualizar nivel curso public async Task UpdateEstado(NivelSNI NivelSNI) { try { var _NivelSNI = await _ctx.NivelSNI.FirstOrDefaultAsync(e => e.NivelSNIId == NivelSNI.NivelSNIId); if (_NivelSNI != null) { _NivelSNI.Estado = NivelSNI.Estado; await _ctx.SaveChangesAsync(); } } catch (Exception e) { throw new Exception(e.Message, e); } }
public async Task <IHttpActionResult> UpdateEstado(NivelSNI NivelSNI) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _nivelRepo.UpdateEstado(NivelSNI); return(Ok("Registro actualizado correctamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }
//crear nivel curso [HttpPost][Authorize] public async Task <IHttpActionResult> Create(NivelSNI NivelSNI) { try { log.Info(new MDCSet(this.ControllerContext.RouteData)); await _nivelRepo.Create(NivelSNI); return(Ok("Registro creado correctamente!")); } catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e); return(InternalServerError(e)); } }