예제 #1
0
        public ActionResult <CrudAngular.Models.Student> PostStudents(CrudAngular.Models.Student student)
        {
            try
            {
                _student.Create(student);
            }
            catch (DbUpdateException)
            {
                if (_student.Any(e => e.Id == student.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetStudents", new { id = student.Id }, student));
        }
 public bool Any()
 {
     return(student.Any());
 }