Пример #1
0
        public IHttpActionResult DeleteSchoolClassTeacherSchoolSubject(int id)
        {
            SchoolClassTeacherSchoolSubjectDTO retVal = service.DeleteSchoolClassTeacherSchoolSubject(id);

            logger.Info("Deleted schoolclassteacherschoolsubject with id {0}", id);
            return(Ok(retVal));
        }
Пример #2
0
        public IHttpActionResult PostSchoolClassTeacherSchoolSubject([FromBody] SchoolClassTeacherSchoolSubjectCreateAndEditDTO dto)
        {
            if (!ModelState.IsValid)
            {
                logger.Warn("schoolclassteacherschoolsubject not created. Bad model state. Returning bad request.");
                return(BadRequest(ModelState));
            }

            SchoolClassTeacherSchoolSubjectDTO retVal = service.CreateSchoolClassTeacherSchoolSubject(dto);

            logger.Info("Created new schoolclassteacherschoolsubject");
            return(Created("", retVal));
        }
Пример #3
0
        public static SchoolClassTeacherSchoolSubjectDTO SchoolClassTeacherSchoolSubjectTo_SchoolClassTeacherSchoolSubjectDTO(SchoolClassTeacherSchoolSubject sctss)
        {
            SchoolClassTeacherSchoolSubjectDTO retVal = new SchoolClassTeacherSchoolSubjectDTO()
            {
                Id                     = sctss.Id,
                SchoolClassId          = sctss.SchoolClass.Id,
                SchoolClassName        = String.Format($"{sctss.SchoolClass.SchoolGrade} {sctss.SchoolClass.Name}"),
                TeacherSchoolSubjectId = sctss.TeacherSchoolSubject.Id,
                TeacherName            = String.Format($"{sctss.TeacherSchoolSubject.Teacher.FirstName} {sctss.TeacherSchoolSubject.Teacher.LastName}"),
                SchoolSubjectName      = sctss.TeacherSchoolSubject.SchoolSubject.Name
            };

            logger.Info("Converting SchoolClassTeacherSchoolSubject to SchoolClassTeacherSchoolSubjectDTO.");
            return(retVal);
        }
Пример #4
0
        public IHttpActionResult GetSchoolClassTeacherSchoolSubject(int id)
        {
            try
            {
                SchoolClassTeacherSchoolSubjectDTO retVal = service.GetById(id);
                if (retVal == null)
                {
                    logger.Warn("No schoolclassteacherschoolsubject with id {0}", id);
                    return(NotFound());
                }

                logger.Info("Returning schoolclassteacherschoolsubject with id {0}", id);
                return(Ok(retVal));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }