public async Task <ActionResult> EditSpeciality(SpecialityViewModel speciality) { string currentUserId = System.Web.HttpContext.Current.User.Identity.GetUserId(); if (currentUserId == null) { return(new HttpUnauthorizedResult()); } ViewBag.SubjectName = (await SpecialityService.GetAsync(speciality.Id)).Subject.SubjectName; ViewBag.ParentId = speciality.SubjectId; ViewBag.Action = "SubjectSpecialities"; if (ModelState.IsValid) { SpecialityDTO specialityDTO = new SpecialityDTO { SpecialityId = speciality.Id, SubjectId = speciality.SubjectId, SpecialityName = speciality.Name, Description = speciality.Description, IsApproved = speciality.IsApproved }; OperationDetails operationDetails = await SpecialityService.UpdateAsync(specialityDTO, currentUserId); if (operationDetails.Succedeed) { return(PartialView("Report", operationDetails)); } else { ModelState.AddModelError(operationDetails.Property, operationDetails.Message); return(PartialView("Report", operationDetails)); } } ViewBag.Message = "Non valid"; return(PartialView("~/Views/Admin/Speciality/EditSpeciality.cshtml", speciality)); }