public ActionResult Edit(int?id) { if (!id.HasValue) { SetViewBagsAndHeaders(Request.IsAjaxRequest(), "Edit project", "Error. Go back to list and choose project."); return(View(new ProjectsViewModel())); } var model = Mapper.Map <ProjectsViewModel>(projectServices.GetById(id ?? 0)); SetViewBagsAndHeaders(Request.IsAjaxRequest(), "Edit project", " "); if (Request.IsAjaxRequest()) { return(PartialView(model)); } return(View(model)); }
public async Task <ActionResult> ChangeActiveProject(int id) { var model = new ProjectBoxViewModel(); var activeProject = int.Parse(User.Identity.GetActiveProject()); ViewBag.AllProjects = true; model.ProjectName = projectServices.GetById(id).ProjectName; var user = UserManager.FindById(User.Identity.GetUserId()); user.ActiveProject = id; IdentityResult result = await UserManager.UpdateAsync(user); var some = User.Identity.GetActiveProject(); Response.Headers["ProjectIsChanged"] = id.ToString(); model.IdProject = UserActiveProject; return(PartialView("LayoutPartials/ProjectSmallBox", model)); }