Beispiel #1
0
        public JsonResult Action(CurrencyActionModel model)
        {
            JsonResult json   = new JsonResult();
            var        result = false;

            if (model.ID > 0) // we are trying to edit a record
            {
                var kBudgets = currencyServices.GetCurrenciesByID(model.ID);

                kBudgets.Name = model.Name;

                result = currencyServices.UpdateCurrencies(kBudgets);
            }
            else  // we are trying to create a record
            {
                Currency kBudgets = new Currency();

                kBudgets.Name = model.Name;

                result = currencyServices.SaveCurrencies(kBudgets);
            }

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

            return(json);
        }
Beispiel #2
0
        public ActionResult Delete(int ID)
        {
            CurrencyActionModel model = new CurrencyActionModel();

            var kBudgets = currencyServices.GetCurrenciesByID(ID);

            model.ID = kBudgets.ID;

            return(PartialView("_Delete", model));
        }
Beispiel #3
0
        public ActionResult Action(int?ID)
        {
            CurrencyActionModel model = new CurrencyActionModel();

            if (ID.HasValue) // we are trying to edit a record
            {
                var kBudgets = currencyServices.GetCurrenciesByID(ID.Value);

                model.ID   = kBudgets.ID;
                model.Name = kBudgets.Name;
            }

            return(PartialView("_Action", model));
        }
Beispiel #4
0
        public JsonResult Delete(CurrencyActionModel model)
        {
            JsonResult json   = new JsonResult();
            var        result = false;

            var kBudgets = currencyServices.GetCurrenciesByID(model.ID);

            result = currencyServices.DeleteCurrencies(kBudgets);

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

            return(json);
        }