//
        // GET: /Currency/Details/By ID
        public ActionResult Details(int id)
        {
            var errorViewModel = new ErrorViewModel();

            try
            {
                var currency = _db.Currencies.Find(id);
                if (currency != null)
                {
                    var viewModel = new CurrencyViewModel() { CurrencyId = currency.CurrencyId, CurrencyName = currency.CurrencyName };
                    return PartialView("_Details", viewModel);
                }

                errorViewModel = ExceptionHelper.ExceptionErrorMessageForNullObject();
            }
            catch (Exception ex)
            {
                errorViewModel = ExceptionHelper.ExceptionErrorMessageFormat(ex);
            }

            return PartialView("_ErrorPopup", errorViewModel);
        }
 //
 // GET: /Currency/Add
 public ActionResult Add()
 {
     var viewModel = new CurrencyViewModel() { CurrencyId = 0 };
     //return View();
     return PartialView("_AddOrEdit", viewModel);
 }
        public ActionResult Save(CurrencyViewModel currencyViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //add
                    if (currencyViewModel.CurrencyId == 0 && currencyViewModel.ActionName == "Add")
                    {
                        var model = new Currency() { CurrencyId = currencyViewModel.CurrencyId, CurrencyName = currencyViewModel.CurrencyName };
                        _db.Currencies.Add(model);
                    }
                    else if (currencyViewModel.ActionName == "Edit") //edit
                    {
                        Currency currency = _db.Currencies.Find(currencyViewModel.CurrencyId);

                        if (currency != null)
                        {

                            currency.CurrencyId = currencyViewModel.CurrencyId;
                            currency.CurrencyName = currencyViewModel.CurrencyName;
                            _db.Entry(currency).State = EntityState.Modified;

                        }
                        else
                        {
                            return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.FalseString, MessageType.warning.ToString(), ExceptionHelper.ExceptionMessageForNullObject()));
                        }
                    }

                    _db.SaveChanges();

                    //return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), "Saved Successfully."));
                    return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, currencyViewModel.ActionName, MessageType.success.ToString(), "Saved Successfully."));

                }

                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), ExceptionHelper.ModelStateErrorFormat(ModelState)));
            }
            catch (Exception ex)
            {
                return Content(KendoUiHelper.GetKendoUiWindowAjaxSuccessMethod(Boolean.TrueString, MessageType.success.ToString(), ExceptionHelper.ExceptionMessageFormat(ex)));
            }
        }