public ActionResult delete(int id) { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib ml = new MeetingLib(); //GET MEETING try { ml = MeetingLibRep.getMeetingLibByID(id); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve meeting: " + exception.Message; return(RedirectToAction("Index")); } //DELETE MEETING try { MeetingLibRep.Delete(ml); TempData["flash"] = "Deleted meeting."; return(RedirectToAction("Index")); } catch (Exception exception) { TempData["flash"] = "Unable to delete meeting: " + exception.Message; return(RedirectToAction("Index")); } }
public void Delete_MeetingLib() { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(2); MeetingLibRep.Delete(m); m = MeetingLibRep.getMeetingLibByID(2); Assert.IsTrue(m.Deleted == true); }