コード例 #1
0
        public ActionResult Save(String ID)
        {
            int id = 0;

            if (ID != "0")//ID=0 for new record
            {
                id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));
            }
            Currency currency = new Currency();

            try
            {
                if (ModelState.IsValid)
                {
                    Services.CurrencyServiceClient currencyServiceClient = new Services.CurrencyServiceClient();

                    currency = currencyServiceClient.GetCurrency(id);
                    //ViewBag.Status = "Save";
                    //ViewBag.Status = "Update";
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "something went wrong");
                currency = null;
                throw e;
            }
            return(View(currency));
        }
コード例 #2
0
        public ActionResult Delete(String ID)
        {
            int id = Convert.ToInt32(Helpers.CommonMethods.Decrypt(HttpUtility.UrlDecode(ID)));//Decrypt ID

            Currency currency = new Currency();

            try
            {
                if (ModelState.IsValid)
                {
                    Services.CurrencyServiceClient currencyServiceClient = new Services.CurrencyServiceClient();

                    currency = currencyServiceClient.GetCurrency(id);
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Went Wrong");
                currency = null;
                throw e;
            }
            return(View(currency));
        }