public IActionResult Update(DlViewModel dlModel) { int id = Convert.ToInt32(TempData["id"]); string rc = PhysicalHelpers.UpdateList(dlModel, id, PhysicalHelpers.SPUPDATELIST); TempData["id"] = id; return(RedirectToAction("Index")); }
// Create Get public IActionResult Create() { var dlmodel = new DlViewModel() { DistrictModel = PhysicalHelpers.PopulateDistricts(), TownModel = PhysicalHelpers.PopulateTowns(), DOWModel = PhysicalHelpers.PopulateDOW(), TimeModel = PhysicalHelpers.PopulateTime(), ListModel = PhysicalHelpers.PopulateList(listId, b, dayId, timeId, town, sp, districtNumber) }; return(View("Create", dlmodel)); }
public IActionResult Create(DlViewModel dl) { //todo: z Create constants for sp for create and update //todo: z Call function, passing in the model, and sp name. //todo: z redirect to index to display the new record with ListId //todo: z Create page -- add vars containers string rc = PhysicalHelpers.UpdateList(dl, listId, PhysicalHelpers.SPUPDATELIST); // Int or string? TempData["id"] = Convert.ToInt32(rc); TempData["sender"] = PhysicalHelpers.CREATE; return(RedirectToAction("Index")); }
// [ValidateAntiForgeryToken] public IActionResult Update(int id) { listId = id; var dlmodel = new DlViewModel() { DistrictModel = PhysicalHelpers.PopulateDistricts(), TownModel = PhysicalHelpers.PopulateTowns(), DOWModel = PhysicalHelpers.PopulateDOW(), TimeModel = PhysicalHelpers.PopulateTime(), ListModel = PhysicalHelpers.PopulateList(listId, b, dayId, timeId, town, sp, districtNumber) }; ViewBag.Result = $"Update meeting with the id: {listId.ToString()}"; TempData["id"] = listId; return(View("Update", dlmodel)); // Update a meeting: " + id.ToString(); }
//private Stream fileStream; public IActionResult Index() { //todo: Add TempData["sender"] for update, created, deleted var list = TempData["id"]; if (list != null) { listId = Convert.ToInt32(list); } var dlmodel = new DlViewModel() { DistrictModel = PhysicalHelpers.PopulateDistricts(), TownModel = PhysicalHelpers.PopulateTowns(), DOWModel = PhysicalHelpers.PopulateDOW(), TimeModel = PhysicalHelpers.PopulateTime(), ListModel = PhysicalHelpers.PopulateList(listId, b, dayId, timeId, town, sp, districtNumber) }; if (listId > 0) { switch (TempData["sender"]) { case "U": ViewBag.Result = $"Meeting id: {listId} has been updated."; break; case "C": ViewBag.Result = $"Meeting id: {listId} has been created."; break; case "D": ViewBag.Result = $"Meeting id: {listId} has been deleted."; break; default: ViewBag.Result = ""; break; } //ViewBag.Result = $"Meeting id: {listId} has been updated."; } dlmodel.SuspendSelect = "0"; ViewBag.Message = TempData["Message"]; return(View(dlmodel)); }
// Delete get // [ValidateAntiForgeryToken] public IActionResult Delete(int id) { // How to display only without the drop downs? listId = id; var dlmodel = new DlViewModel() { DistrictModel = PhysicalHelpers.PopulateDistricts(), TownModel = PhysicalHelpers.PopulateTowns(), DOWModel = PhysicalHelpers.PopulateDOW(), TimeModel = PhysicalHelpers.PopulateTime(), ListModel = PhysicalHelpers.PopulateList(listId, b, dayId, timeId, town, sp, districtNumber) }; TempData["id"] = listId; // TempData["sender"] = UPDATE; return(View("Delete", dlmodel)); // Update a meeting: " + id.ToString(); }
public IActionResult Index(char?SuspendSelect, int?DOWSelect, int?TimeSelect, string TownSelect, int?DistrictSelect) { //todo: code for null vars coming in. b = (char)SuspendSelect; //dayId = (int)DOWSelection; //timeId = (int)TimeSelection; //town = TownSelection.ToString(); var dlmodel = new DlViewModel() { DistrictModel = PhysicalHelpers.PopulateDistricts(), TownModel = PhysicalHelpers.PopulateTowns(), DOWModel = PhysicalHelpers.PopulateDOW(), TimeModel = PhysicalHelpers.PopulateTime(), ListModel = PhysicalHelpers.PopulateList(listId, b, DOWSelect, TimeSelect, TownSelect, sp, DistrictSelect) }; return(View(dlmodel)); }