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); }
public ActionResult Edit(int id, FormCollection collection) { try { // TODO: Add update logic here IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(id); m.MeetingLibDesc = collection["meeting_description"]; m.MeetingLibNumber = collection["meeting_number"]; m.MeetingLibDate = DateTime.Parse(collection["meeting_date"]); m.DateModified = DateTime.Now; MeetingLibRep.Save(m); return(RedirectToAction("Index")); } catch (SubSonic.SqlQueryException e) { Console.WriteLine("{0} Exception caught.", e.Message); IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(id); ViewData.Model = m; return(View()); } }
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 MeetingLibs_Get_By_ID() { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(1); Assert.AreEqual(m.MeetingLibDesc, "Animal"); }
public ActionResult Edit(int id) { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(id); ViewData.Model = m; return(View()); }
public void Modify_MeetingLib() { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(2); m.MeetingLibDesc = "PLants Committee"; m.DateModified = DateTime.Now; int saved = MeetingLibRep.Save(m); Assert.AreEqual(saved, 1); }
public void Update_Meeting_Lib() { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = MeetingLibRep.getMeetingLibByID(2); FormCollection form = new FormCollection(); form["MeetingLibNumber"] = "x"; form["MeetingLibDesc"] = "xy"; form["MeetingLibDate"] = "01/01/2009"; m.MeetingLibDesc = form["MeetingLibDesc"]; m.MeetingLibNumber = form["MeetingLibNumber"]; m.MeetingLibDate = DateTime.Parse(form["MeetingLibDate"]); MeetingLibRep.Save(m); Assert.AreEqual(MeetingLibRep.Save(m), 0); }