Пример #1
0
        public IHttpActionResult PutTeacher(string id, TeacherDTO teacher)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != teacher.TeacherId)
            {
                return(BadRequest());
            }


            try
            {
                bizTeacher.updateTeacher(teacher);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TeacherExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }