Exemple #1
0
        public ActionResult Delete(int ID)
        {
            MainMenuActionModel model = new MainMenuActionModel();

            var mainMenu = services.GetMainMenuByID(ID);

            model.MainMenuID = mainMenu.MainMenuID;

            return(PartialView("_Delete", model));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }