public async Task <ActionResult> UpdateStudentProfile(UpdateStudentProfileViewModel model) { if (ModelState.IsValid) { await _studentAdminService.UpdateProfileAsync(new UpdateStudentProfileRequest { Id = model.Id, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, GroupId = model.GroupId }); return(RedirectToAction("Index", new { groupId = model.GroupId })); } ViewBag.Title = "Edit student"; return(View(model)); }
public async Task <ActionResult> UpdateStudentProfile(Guid profileId) { var student = await _studentAdminService.GetStudentByIdAsync(profileId); var groups = await _groupAdminService.GetAllGroupsAsync(); var viewModel = new UpdateStudentProfileViewModel { Id = student.Id, FirstName = student.FirstName, LastName = student.LastName, Email = student.Email, Groups = groups.ToStudentSelectListItems(student.GroupId), GroupId = student.GroupId }; ViewBag.Title = $"Edit student \"{student.FirstName} {student.LastName}\""; return(View(viewModel)); }