public async Task <IActionResult> AddUpdate() { var genders = await _optionManager.GetGenders(); var studentAddUpdateViewModel = new StudentAddUpdateViewModel { Genders = genders }; return(View(studentAddUpdateViewModel)); }
public async Task <IActionResult> AddUpdate(StudentAddUpdateViewModel studentAddUpdateViewModel) { var genders = await _optionManager.GetGenders(); var studentBlDto = _mapper.Map <StudentBlDto>(studentAddUpdateViewModel.Student); var studentAddUpdateModel = new StudentAddUpdateModel { Student = studentBlDto }; var result = await _studentManager.Add(studentAddUpdateModel); ModelState.FromSpec(result.SpecResult.FailedSpecifications); studentAddUpdateViewModel.Student.Id = result.Data; studentAddUpdateViewModel.Message = result.Message; studentAddUpdateViewModel.Genders = genders; return(View(studentAddUpdateViewModel)); }