Пример #1
0
        public async Task <Student> AddAsync(Student student)
        {
            var result = await _studentRepository.AddItemAsync(student);

            student.StudentId = result.StudentId;
            return(student);
        }
Пример #2
0
        public IActionResult Create(StudentViewModel model)
        {
            if (model.IsEmpty())
            {
                return(View(model));
            }

            _repository.AddItemAsync(model);
            return(Redirect("GetAll"));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("FirstName,LastName,Id")] Student student)
        {
            if (ModelState.IsValid)
            {
                student.Id = Guid.NewGuid();
                await _repository.AddItemAsync(student);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Пример #4
0
        public async Task <IActionResult> Add(StudentVM stud)
        {
            await _repository.AddItemAsync(stud);

            return(RedirectToAction("List"));
        }