public ActionResult Delete(int ID) { MainMenuActionModel model = new MainMenuActionModel(); var mainMenu = services.GetMainMenuByID(ID); model.MainMenuID = mainMenu.MainMenuID; return(PartialView("_Delete", model)); }
public ActionResult AddAndEdit(int?ID) { MainMenuActionModel model = new MainMenuActionModel(); if (ID.HasValue) { var mainMenu = services.GetMainMenuByID(ID.Value); model.MainMenuID = mainMenu.MainMenuID; model.MainMenuName = mainMenu.MainMenuName; model.Description = mainMenu.Description; } return(PartialView("_AddAndEdit", model)); }
public JsonResult AddAndEdit(MainMenuActionModel model) { JsonResult json = new JsonResult(); var result = false; if (model.MainMenuID > 0) { var mainMenu = services.GetMainMenuByID(model.MainMenuID); mainMenu.MainMenuName = model.MainMenuName; mainMenu.Description = model.Description; mainMenu.UpdatedAt = DateTime.Now; result = services.UpdateMenu(mainMenu); } else { MainMenu mainMenu = new MainMenu(); mainMenu.MainMenuName = model.MainMenuName; mainMenu.Description = model.Description; mainMenu.UpdatedAt = DateTime.Now; result = services.SaveMenu(mainMenu); } if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform action on Main Menu" }; } return(json); }
public JsonResult Delete(MainMenuActionModel model) { JsonResult json = new JsonResult(); var result = false; var mainMenu = services.GetMainMenuByID(model.MainMenuID); result = services.DeleteMenu(mainMenu); if (result) { json.Data = new { Success = true }; } else { json.Data = new { Success = false, Message = "Unable to perform action on Main Menu" }; } return(json); }