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));
        }
Example #2
0
        public async Task <ActionResult> Edit(TeacherEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                UpdateStudentProfileRequest updateStudentProfileRequest = new UpdateStudentProfileRequest()
                {
                    Id        = model.Id,
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    Email     = model.Email,
                    GroupId   = null
                };
                await _studentAdminService.UpdateProfileAsync(updateStudentProfileRequest);

                return(RedirectToAction("Index"));
            }
            ViewBag.Title = "Editing an account";
            return(View(model));
        }