public async Task Execute(CreateFacultyInput input)
        {
            if (input == null)
            {
                outputPort.WriteError(""); return;
            }

            int facultyId = await facultyRepository.Create(input.Title, input.Head, input.Subhead);

            outputPort.Standart(new CreateFacultyOutput(facultyId));
        }
Example #2
0
        public IActionResult Create(Faculty newFaculty)
        {
            if (ModelState.IsValid)
            {
                //TODO: Add checking on existing faculty
                _repository.Create(newFaculty);

                return(RedirectToAction("list", "faculties"));
            }

            return(View("index", "index"));
        }
        public ActionResult Create(Faculty faculty)
        {
            if (ModelState.IsValid)
            {
                repository.Create(faculty);

                TempData["message"] = "Факультет успешно добавлен";

                return(RedirectToAction("Index"));
            }

            return(View(faculty));
        }
Example #4
0
        /// <summary>
        /// Создает Факультет.
        /// </summary>
        /// <param name="faculty">Факультет.</param>
        /// <returns>Идентификаторо созданного факультета.</returns>
        public int Create(FacultyItem faculty)
        {
            if (string.IsNullOrEmpty(faculty.FullName))
            {
                throw new Exception("Поле 'FullName' не должно быть пустым.");
            }

            if (string.IsNullOrEmpty(faculty.ShortName))
            {
                throw new Exception("Поле 'ShortName' не должно быть пустым.");
            }

            return(_facultyRepository.Create(faculty));
        }
        public JsonResult PostFaculties([FromBody] FacultyVM[] GG)
        {
            int?id = repository.Create(GG);

            return(Json(id));
        }
Example #6
0
 public async Task <Faculty> Create(Faculty user)
 {
     return(await _facultyService.Create(user));
 }
 public void Create(Faculty faculty)
 {
     _facultyRepository.Create(faculty);
 }