public ActionResult Delete(int id) { var eventToDelete = this.LoadEvent(id); if (eventToDelete == null) { this.AddNotification("Cannot delete event #" + id, NotificationType.ERROR); return(this.RedirectToAction("My")); } var model = EventViewModel.CreateFromEvent(eventToDelete); return(this.View(model)); }
public ActionResult Delete(int?Id) { if (Id == null) { this.AddNotification("Cannot delete event # " + Id, NotificationType.ERROR); return(RedirectToAction("My")); } Event e = LoadEvent(Id.Value); if (e == null) { this.AddNotification("Cannot delete event # " + Id, NotificationType.ERROR); return(RedirectToAction("My")); } var model = EventViewModel.CreateFromEvent(e); return(View(model)); }