Пример #1
0
        public ActionResult Put(int id, [FromBody] StudentDto value)
        {
            var result = _studentService.UpdateStudent(value.ToModel());

            if (result.HasErrors)
            {
                return(BadRequest(result.Errors));
            }
            return(Accepted());
        }
Пример #2
0
        public ActionResult <StudentDto> Post([FromBody] StudentDto student)
        {
            var result = _studentService.CreateStudent(student.ToModel());

            if (result.HasErrors)
            {
                return(BadRequest(result.Errors));
            }
            return(Accepted(StudentDto.FromModel(result.Result)));
        }
Пример #3
0
 public ActionResult Put(int id, [FromBody] StudentDto value)
 {
     _studentService.UpdateStudent(value.ToModel());
     return(Accepted());
 }
Пример #4
0
        public ActionResult <StudentDto> Post([FromBody] StudentDto student)
        {
            var createdStudent = _studentService.CreateStudent(student.ToModel());

            return(Accepted(StudentDto.FromModel(createdStudent)));
        }