public bool Edit(ReplyUpdateModel model) { var entity = _ctx.Replies .Where(e => e.OwnerId == _userId) .Single(e => e.ReplyId == model.ReplyId); if (entity != null) { entity.Content = model.Content; entity.LastUpdated = DateTime.Now; } ; return(_ctx.SaveChanges() == 1); }
public ActionResult Edit(ReplyUpdateModel model) { if (!ModelState.IsValid) { return(View(model)); } var replyService = CreateReplyService(); if (replyService.Edit(model)) { TempData["SaveResult"] = "Reply Updated!"; return(Redirect(Request.UrlReferrer.ToString())); } ModelState.AddModelError("", "Reply was not updated"); return(View(model)); }