public ActionResult CreateEdit(UExchangeRate exRate, string Action = "") { if (ModelState.IsValid) { if (!exRate.Id.Equals(Guid.Empty)) { exRate._ExchangeRate.CountryProgrammeId = countryProg.Id; if (exchangeRateService.EditExchangeRate(exRate._ExchangeRate)) { ModelState.Clear(); exRate = new UExchangeRate(); } } else { exRate._ExchangeRate.CountryProgrammeId = countryProg.Id; if (exchangeRateService.AddExchangeRate(exRate._ExchangeRate)) { ModelState.Clear(); exRate = new UExchangeRate(); } } } exRate.CurrencySelect = new SelectList(exchangeRateService.CurrencyObj.GetCurrencies(countryProg.Id), "Id", "Name"); return(ListView()); }
// // GET: CreateEdit public ActionResult CreateEdit(string xid) { UExchangeRate exRate = new UExchangeRate(); exRate.CurrencySelect = new SelectList(exchangeRateService.CurrencyObj.GetCurrencies(countryProg.Id), "Id", "Name"); exRate.MainCurrencyId = mbCurrency.Id.ToString(); exRate.MonthSelect = new SelectList(ExchangeRateExtension.GetMonths(), "Month", "MonthName"); exRate.Month = DateTime.Today.Month; exRate.Year = DateTime.Today.Year; Guid excRateId; if (Guid.TryParse(xid, out excRateId)) { ViewBag.Action = "Edit"; exRate._ExchangeRate = exchangeRateService.GetExchangeRate(excRateId); } return(View(exRate)); }