public static void UpdateMeetingLib(MeetingLib m, FormCollection collection) { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); m.MeetingLibDesc = collection["MeetingLibDesc"]; m.MeetingLibNumber = collection["MeetingLibNumber"]; m.MeetingLibDate = DateTime.Parse(collection["meeting_date"]); m.DateModified = DateTime.Now; MeetingLibRep.Save(m); return; }
public void Adding_MeetingLib() { IMeetingLibRepository MeetingLibRep = new MeetingLibRepository(); MeetingLib m = new MeetingLib(); IList<SelectItems> allItems = new List<SelectItems>(); allItems.ToPagedList(0, 10); m.MeetingLibDesc = "Plants"; m.MeetingLibNumber = "PL01"; m.MeetingLibDate = DateTime.Parse("02/02/2009"); m.DateAdded = DateTime.Now; m.DateModified = DateTime.Now; int saved = MeetingLibRep.Save(m); Assert.AreEqual(saved, 3); }
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); }
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 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(); } }