public ActionResult Delete(string id, FormCollection collection) { bool DidItWork = false; string CrudAction = "Delete"; try { TeamViewBusinessLayer bl = new TeamViewBusinessLayer(); TeamView a = bl.TeamViews.Where(p => p.ID == id).Single(); StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer(); DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name); if (DidItWork == false) { return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name))); } else { return(RedirectToAction("Index")); } } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { bool DidItWork = false; string CrudAction = "Create"; try { TeamView a = new TeamView(); #region Pull from Form Collection a.TeamID = Convert.ToInt16(collection["ddTeam"]); a.ViewID = Convert.ToInt16(collection["ddPivotView"]); a.ViewDescription = ""; a.TeamDescription = ""; #endregion StoredProcedureBusinessLayer spbl = new StoredProcedureBusinessLayer(); DidItWork = spbl.ExecuteStoredProcedure(a, CrudAction, User.Identity.Name); if (DidItWork == false) { return(Content(string.Format("Error on {0} of {1}. Press back to return and try again", CrudAction, a.GetType().Name))); } else { return(RedirectToAction("Index")); } } catch { return(View()); } }