public async Task <IActionResult> OnGetAsync(int id) { var user = await _userService.GetByUsername(User.Identity.Name); if (user == null) { return(Unauthorized()); } try { var page = await _pageService.GetByIdWithAllParents(id); if (_pageService.CheckAccess(page, user)) { Item = page; PageModel = _mapper.Map <UpdatePageModel>(page); } else { return(Unauthorized()); } } catch (ApplicationException) { return(BadRequest()); } return(Page()); }
public IActionResult Update([FromRoute] int pageOrder, [FromBody] UpdatePageModel model) { var userId = this.GetAuthorizeUserId(); this._pageRepository.EditPageByOrder(pageOrder, model.Title, model.Text); return(new NoContentResult()); }
public async Task <ActionResult> Update([Bind(Include = "url, name, group, body")] UpdatePageModel model) { ActionResult result = null; await Pages.UpdatePage(model.Url, model.Name, model.Group, model.Body); result = Redirect(Request.UrlReferrer.ToString()); return(result); }