Пример #1
0
        public ActionResult Edit(Currency model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();

            var  repo     = new CurrencyRepository();
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Currency", "CurrencyName", model.CurrencyName, "CurrencyId", model.CurrencyId);

            if (!isexists)
            {
                var result = new CurrencyRepository().UpdateCurrency(model);
                if (result.CurrencyId > 0)
                {
                    TempData["Success"] = "Updated Successfully!";
                    TempData["RefNo"]   = result.CurrencyRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    FillCurrencySymbols();
                    TempData["error"] = "Oops!!..Something Went Wrong!!";
                    TempData["RefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                FillCurrencySymbols();
                TempData["error"] = "This Name Alredy Exists!!";
                TempData["RefNo"] = null;
                return(View("Create", model));
            }
        }