public async Task <ActionResult> ContentPageUpdate(int?id) { var userId = User.Identity.GetUserId(); var user = await UserManager.FindByIdAsync(userId); var model = new ContentPage(); if (!id.HasValue || id == 0) { model.Author = user.FullName; } else { model = await _contentPageService.FindAsync(id); } return(View(model)); }
public async Task<ActionResult> ContentPageUpdate(int? id) { var userId = User.Identity.GetUserId(); var user = await UserManager.FindByIdAsync(userId); ViewBag.Roles = RoleManager.Roles.OrderBy(ob => ob.Name).ToList(); var model = new ContentPage(); var modelPageRoles = await _contentPageRoleService.Query().SelectAsync(); model.ContentPageRoles = modelPageRoles.ToList(); if (!id.HasValue || id == 0) { model.Author = user.FullName; } else { model = await _contentPageService.FindAsync(id); var contentPageRoles = await _contentPageRoleService.Query(x => x.ContentPageID == id.Value).SelectAsync(); model.ContentPageRoles = contentPageRoles.ToList(); } return View(model); }