Example #1
0
 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);
 }
Example #2
0
 public ActionResult Delete(string id, Post aPost)
 {
     try
     {
         _dataRepository.Remove(id);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Example #3
0
        public ActionResult Create(Post aPost)
        {
            try
            {
                _dataRepository.Create(aPost);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #4
0
 public void Create(Post aPost)
 {
     aPost.Comments = new List<Comment>();
     _collection.Save(aPost);
 }
Example #5
0
 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);
     }
 }