public ActionResult delete(int id) { CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); //GET Committee try { committee = committee_rep.getCommittee(id); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve committee: " + exception.Message; return RedirectToAction("Index"); } //DELETE Committee try { committee_rep.delete(committee); TempData["flash"] = "Deleted committee."; return RedirectToAction("Index"); } catch (Exception exception) { TempData["flash"] = "Unable to delete committee: " + exception.Message; return RedirectToAction("Index"); } }
public ActionResult edit(FormCollection collection) { //Generate new Committee object for form if error CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); //GET Committee try { committee = committee_rep.getCommittee(Int32.Parse(collection["committee_id"])); TempData["committee"] = committee; } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve committee: " + exception.Message; return(RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] })); } //UPDATE Committee try { return(committeeFormProcess(committee, committee_rep, collection)); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to update committee: " + exception.Message; return(RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] })); } }
public ActionResult delete(int id) { CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); //GET Committee try { committee = committee_rep.getCommittee(id); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve committee: " + exception.Message; return(RedirectToAction("Index")); } //DELETE Committee try { committee_rep.delete(committee); TempData["flash"] = "Deleted committee."; return(RedirectToAction("Index")); } catch (Exception exception) { TempData["flash"] = "Unable to delete committee: " + exception.Message; return(RedirectToAction("Index")); } }
public ActionResult create() { //Generate new Committee object CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); ViewData["edit"] = false; ViewData["committee"] = committee; return View(); }
public ActionResult create() { //Generate new Committee object CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); ViewData["edit"] = false; ViewData["committee"] = committee; return(View()); }
//PROCESS EDIT AND CREATE FORMS private ActionResult committeeFormProcess(CommitteeLib committee, CommitteeLibRepository committee_rep, FormCollection collection) { try { committee.Description = collection["committee_description"]; committee_rep.save(committee); TempData["flash"] = "Committee: " + committee.Description; return(RedirectToAction("Index")); } catch (Exception exception) { throw new Exception("A data entry problem has occurred."); } }
public ActionResult create(FormCollection collection) { //Generate new Committee object CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); ViewData["edit"] = false; ViewData["committee"] = committee; try { return committeeFormProcess(committee, committee_rep, collection); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to create committee: " + exception.Message; return RedirectToAction("create"); } }
public ActionResult create(FormCollection collection) { //Generate new Committee object CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); ViewData["edit"] = false; ViewData["committee"] = committee; try { return(committeeFormProcess(committee, committee_rep, collection)); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to create committee: " + exception.Message; return(RedirectToAction("create")); } }
public void Insert(string Description,DateTime? DateAdded,bool Deleted) { CommitteeLib item = new CommitteeLib(); item.Description = Description; item.DateAdded = DateAdded; item.Deleted = Deleted; item.Save(UserName); }
public void Update(int Id,string Description,DateTime? DateAdded,bool Deleted) { CommitteeLib item = new CommitteeLib(); item.MarkOld(); item.IsLoaded = true; item.Id = Id; item.Description = Description; item.DateAdded = DateAdded; item.Deleted = Deleted; item.Save(UserName); }
public void delete(CommitteeLib c) { DB.Delete(c); }
public int save(CommitteeLib c) { return(DB.Save(c)); }
public int save(CommitteeLib c) { return DB.Save(c); }
//PROCESS EDIT AND CREATE FORMS private ActionResult committeeFormProcess(CommitteeLib committee, CommitteeLibRepository committee_rep, FormCollection collection) { try { committee.Description = collection["committee_description"]; committee_rep.save(committee); TempData["flash"] = "Committee: " + committee.Description; return RedirectToAction("Index"); } catch (Exception exception) { throw new Exception("A data entry problem has occurred."); } }
public ActionResult edit(FormCollection collection) { //Generate new Committee object for form if error CommitteeLibRepository committee_rep = new CommitteeLibRepository(); CommitteeLib committee = new CommitteeLib(); //GET Committee try { committee = committee_rep.getCommittee(Int32.Parse(collection["committee_id"])); TempData["committee"] = committee; } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to retrieve committee: " + exception.Message; return RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] }); } //UPDATE Committee try { return committeeFormProcess(committee, committee_rep, collection); } catch (Exception exception) { //IF THERE IS A MESS UP, RETURN ERROR TO FRONT TempData["flash"] = "Unable to update committee: " + exception.Message; return RedirectToAction("edit", new { controller = "Committees", id = collection["committee_id"] }); } }