Exemple #1
0
        public ActionResult CurrencyEdit(CurrencyViewModel model)
        {
            if (ModelState.IsValid)
            {
                var persistentEntity = _currencyService.GetSingle(model.Id);
                if (persistentEntity != null)
                {
                    persistentEntity.ConversionRateToDefault = model.ConversionRateToDefault;
                    persistentEntity.IsDefaultCurrency = model.IsDefaultCurrency;
                    persistentEntity.Name = model.Name;
                    persistentEntity.Symbol = model.Symbol;
                    return Json(new { });
                }

                ModelState.AddModelError("", "Could not edit a record that does not exist");
            }
            return PartialView(model);
        }
Exemple #2
0
 public ActionResult CurrencyCreate(CurrencyViewModel model)
 {
     if (ModelState.IsValid)
     {
         var m = Mapper.Map<Currency>(model);
         _currencyService.Create(m);
         return Json(new {});
     }
     return PartialView(model);
 }