コード例 #1
0
        public IHttpActionResult CreateGradeAdmin(string teacherId, [FromBody] GradeCreateAndEditDTO dto)
        {
            if (!ModelState.IsValid)
            {
                logger.Warn("Bad model state.");
                return(BadRequest());
            }

            try
            {
                GradeDTO retVal = service.CreateGrade(teacherId, dto);

                logger.Info("Admin creted grade. status OK");
                return(Ok(retVal));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }