public ActionResult Details(int?id) { ScrimRoll bl = new ScrimRoll(); ViewBag.ScrimRoll = bl.GetScrimRollModels(); if (id == null) { ((List <ScrimRollModel>)ViewBag.ScrimRoll).Insert(0, new ScrimRollModel()); GetRollTypesList(); GetUoMList(); //return View(bl.GetScrimRollModelsByTypeID(1)); return(View(new List <ScrimRollModel>())); } else { GetRollTypesList(); GetUoMList(); //ScrimRollModel model = bl.GetScrimRollModelByID((int)id); List <ScrimRollModel> model = bl.GetScrimRollModelsByTypeID((int)id); if (model == null) { //TempData["ActionMessage"] = string.Format("ScrimRoll with ID {0} not found.", id); TempData["ActionMessage"] = TPO.BL.Repositories.Message.MessageRepository.GetStringValue(MessageKeys.ResponseMessageFailNoId); TempData["ActionMessageType"] = TPO.BL.Repositories.Message.MessageRepository.GetStringValue(MessageKeys.ResponseTypeError); return(RedirectToAction("Details")); //return HttpNotFound(string.Format("ScrimRoll with ID {0} not found.", id)); } return(View(model)); } }
// // GET: /ScrimRoll/Edit/5 public ActionResult Edit(int id = 0) { if (id == 0) { //removed to keep from initial load of scrim page from displaying error. //TempData["ActionMessage"] = TPO.BL.Constants.Responses.ResponseMessages["FailNoId"]; //TempData["ActionMessageType"] = TPO.BL.Constants.Responses.ResponseTypes["error"]; return(RedirectToAction("Details")); } GetRollTypesList(); GetUoMList(); ScrimRoll bl = new ScrimRoll(); ViewBag.ScrimRoll = bl.GetScrimRollModels(); ScrimRollModel model = bl.GetScrimRollModelByID(id); if (model == null) { model = new ScrimRollModel(); } return(View(model)); }