public IHttpActionResult EditGradeAdmin(int id, string teacherId, [FromBody] GradeCreateAndEditDTO dto) { if (!ModelState.IsValid) { logger.Warn("Bad model state."); return(BadRequest()); } try { GradeDTO retVal = service.EditGrade(id, teacherId, dto); logger.Info("Admin edited grade. status OK"); return(Ok(retVal)); } catch (Exception e) { return(BadRequest(e.Message)); } }