Пример #1
0
        public ActionResult FacultyCreate(Faculty faculty)
        {
            if (!ModelState.IsValid)
            {
                return(View(faculty));
            }
            else if (_facultyService.Find(f => f.FacultyNumber == faculty.FacultyNumber).Any())
            {
                ModelState.AddModelError("FacultyCreate", "This faculty already exists.");

                return(View(faculty));
            }
            else if (faculty.AllPlaces < faculty.BudgetPlaces)
            {
                ModelState.AddModelError("FacultyCreate", "Number of budget seats mast be less or equal than all seats number.");

                return(View(faculty));
            }

            _facultyService.Create(faculty);

            return(RedirectToAction("GetFaculty", "Faculty", new { area = "Operator" }));
        }