// GET: Flowers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Flower flower = uow.Flowers.GetFlower(id.Value); if (flower == null) { return(HttpNotFound()); } // Generate display view model FlowerDisplayViewModel displayFlower = FlowerViewModelFactory.CreateDisplayModel(flower, uow); // Remove notification if exists Notification n = uow.Notifications.Find(User.Identity.Name, id.Value); if (n != null) { uow.Notifications.Remove(n); } return(View(displayFlower)); }
// GET: Flowers/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Flower flower = uow.Flowers.GetFlower(id.Value); if (flower == null) { return(HttpNotFound()); } else if (!IsOwner(flower)) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden, "You do not own the flower you request to delete")); } var flowerModel = FlowerViewModelFactory.CreateAddOrEditViewModel(flower); return(View(flowerModel)); }