public ActionResult Delete(int ID)
        {
            BudgetActionModel model = new BudgetActionModel();

            var budgets = budgetServices.GetBudgetsByID(ID);

            model.ID = budgets.ID;

            return(PartialView("_Delete", model));
        }
        public ActionResult Action(int?ID)
        {
            BudgetActionModel model = new BudgetActionModel();

            if (ID.HasValue) //we are trying to edit a record
            {
                var budgets = budgetServices.GetBudgetsByID(ID.Value);

                model.ID        = budgets.ID;
                model.KBudgetID = budgets.KBudgetID;
                model.Name      = budgets.Name;
            }

            model.KBudgets = kBudgetServices.GetAllKBudgets();

            return(PartialView("_Action", model));
        }
        public JsonResult Delete(BudgetActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            var budgets = budgetServices.GetBudgetsByID(model.ID);

            result = budgetServices.DeleteBudgets(budgets);

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform action on Debts." };
            }

            return(json);
        }
        public JsonResult Action(BudgetActionModel model)
        {
            JsonResult json = new JsonResult();

            var result = false;

            if (model.ID > 0) //we are trying to edit a record
            {
                var budgets = budgetServices.GetBudgetsByID(model.ID);

                budgets.KBudgetID = model.KBudgetID;
                budgets.ID        = model.ID;

                budgets.Name = model.Name;

                result = budgetServices.UpdateBudgets(budgets);
            }
            else //we are trying to create a record
            {
                Budget budgets = new Budget();

                budgets.KBudgetID = model.KBudgetID;
                budgets.ID        = model.ID;

                budgets.Name = model.Name;

                result = budgetServices.SaveBudgets(budgets);
            }

            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to perform action on Debt." };
            }

            return(json);
        }