public IExecutionResult Update(ArticleModifyViewModel model, string currentLoggedUserId) { if (model.AuthorId == currentLoggedUserId) { return(base.Update(model)); } return(new ExecutionResult() { Succeded = false, Message = GlobalMessages.NoAccess("article") }); }
public ActionResult Edit(ArticleModifyViewModel model) { if (!ModelState.IsValid) { return(View()); } try { Service.Update(model, HttpContext.User.Identity.GetUserId()); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(ArticleModifyViewModel model) { if (!ModelState.IsValid) { return(View()); } try { model.AuthorId = HttpContext.User.Identity.GetUserId(); var execution = Service.Create(model); if (!execution.Succeded) { return(View()); } return(RedirectToAction("Index")); } catch { return(View()); } }
public override IExecutionResult Create(ArticleModifyViewModel model) { model.PublishDate = DateTime.Now; return(base.Create(model)); }