public ActionResult Edit(int id, FormCollection collection) { bool DidItWork = false; string CrudAction = "Edit"; try { MeTypeBusinessLayer bl = new MeTypeBusinessLayer(); MeType a = bl.MeTypes.Where(p => p.MeTypeID == id).Single(); #region Pull from Form Collection a.MeTypeDesc = (string)collection["MeTypeDesc"]; #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()); } }
// GET: SpaceAllocation/Edit/5 public ActionResult AddNew(string id) { SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer(); SpaceAllocation sa = sbl.SpaceAllocations.Where(i => i.ID == id).Single(); int MaxOrdinalSequence = sbl.SpaceAllocations.Where(t => t.SeasonID == sa.SeasonID && t.SpaceID == sa.SpaceID && t.CatID == sa.CatID && t.SpaceGradeID == sa.SpaceGradeID && t.FixtureOrdinal == sa.FixtureOrdinal).Max(s => s.OrdinalSequence); sa.OrdinalSequence = MaxOrdinalSequence + 1; MeTypeBusinessLayer m = new MeTypeBusinessLayer(); List <MeType> ListOfMeTypes = m.MeTypes.ToList(); ViewData["ddMeType"] = ListOfMeTypes.Select(k => new SelectListItem { Value = k.MeTypeID.ToString(), Text = k.MeTypeDesc, Selected = k.MeTypeID == sa.MeTypeID }); PreArticleSeasonalBusinessLayer pbl = new PreArticleSeasonalBusinessLayer(); List <PreArticleSeasonal> ListOfPreArticleSeasonals = pbl.PreArticleSeasonals.Where(j => j.SeasonID == sa.SeasonID || j.SFID == sa.SFID).ToList(); ViewData["ddPAS"] = ListOfPreArticleSeasonals.Select(k => new SelectListItem { Value = k.SFID.ToString(), Text = k.SunflowerDesc + " (" + k.SFID + ")", Selected = k.SFID == sa.SFID }); return(View(sa)); }
// GET: MeType public ActionResult Index() { MeTypeBusinessLayer sbl = new MeTypeBusinessLayer(); List <MeType> ListOfMeTypes = sbl.MeTypes.OrderBy(i => i.MeTypeID).ToList(); return(View(ListOfMeTypes)); }
// GET: MeType/Edit/5 public ActionResult Edit(int id) { MeTypeBusinessLayer bl = new MeTypeBusinessLayer(); MeType o = bl.MeTypes.Where(p => p.MeTypeID == id).Single(); ViewBag.ID = id; return(View(o)); }
// GET: SpaceAllocation/Edit/5 public ActionResult Edit(string id) { SpaceAllocationBusinessLayer sbl = new SpaceAllocationBusinessLayer(); SpaceAllocation sa = sbl.SpaceAllocations.Where(i => i.ID == id).Single(); MeTypeBusinessLayer m = new MeTypeBusinessLayer(); List <MeType> ListOfMeTypes = m.MeTypes.ToList(); ViewData["ddMeType"] = ListOfMeTypes.Select(k => new SelectListItem { Value = k.MeTypeID.ToString(), Text = k.MeTypeDesc, Selected = k.MeTypeID == sa.MeTypeID }); PreArticleSeasonalBusinessLayer pbl = new PreArticleSeasonalBusinessLayer(); List <PreArticleSeasonal> ListOfPreArticleSeasonals = pbl.PreArticleSeasonals.Where(j => j.SeasonID == sa.SeasonID || j.SFID == sa.SFID).ToList(); ViewData["ddPAS"] = ListOfPreArticleSeasonals.Select(k => new SelectListItem { Value = k.SFID.ToString(), Text = k.SunflowerDesc + " (" + k.SFID + ")", Selected = k.SFID == sa.SFID }); return(View(sa)); }