public void Edit(Post aPost, string idValue) { var updatedPost = GetAPostWithId(idValue); updatedPost.Title = aPost.Title; updatedPost.Body = aPost.Body; updatedPost.CharCount = aPost.CharCount; _collection.Save(updatedPost); }
public ActionResult Delete(string id, Post aPost) { try { _dataRepository.Remove(id); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Post aPost) { try { _dataRepository.Create(aPost); return RedirectToAction("Index"); } catch { return View(); } }
public void Create(Post aPost) { aPost.Comments = new List<Comment>(); _collection.Save(aPost); }
public ActionResult Edit(String id, Post aPost) { try { // TODO: Add update logic here _dataRepository.Edit(aPost, id); return RedirectToAction("Index"); } catch (Exception e) { throw new Exception(e.Message); } }