Ejemplo n.º 1
0
 public ActionResult Currency_Destroy([DataSourceRequest] DataSourceRequest request, CurrencyViewModel currencyViewModel)
 {
     if (currencyViewModel != null && ModelState.IsValid)
     {
         var currency = _currencyService.FindById(currencyViewModel.CurrencyID);
         _currencyService.DeleteCurrency(currency);
     }
     return Json(ModelState.ToDataSourceResult());
 }
Ejemplo n.º 2
0
        public ActionResult Currency_Create([DataSourceRequest] DataSourceRequest request, CurrencyViewModel currency)
        {
            if (currency != null && ModelState.IsValid)
            {

                _currencyService.AddCurrency(BindCurrency(currency));
            }

            return Json(new[] { currency }.ToDataSourceResult(request, ModelState));
        }
Ejemplo n.º 3
0
 public ActionResult Currency_Update([DataSourceRequest] DataSourceRequest request, CurrencyViewModel currencyViewModel)
 {
     if (currencyViewModel != null && ModelState.IsValid)
     {
         var origin = _currencyService.FindById(currencyViewModel.CurrencyID);
         origin.Code = currencyViewModel.CurrencyCode;
         origin.Name = currencyViewModel.CurrencyName;
         _currencyService.EditCurrency(origin);
     }
     return Json(new[] { currencyViewModel }.ToDataSourceResult(request, ModelState));
 }
Ejemplo n.º 4
0
        public ActionResult Currency_Create([DataSourceRequest] DataSourceRequest request, CurrencyViewModel currency)
        {
            var curencyCodeExists = _currencyService.FindBy(m => m.Code == currency.CurrencyCode).Count;
            if (currency != null && curencyCodeExists==0 && ModelState.IsValid)
            {

                _currencyService.AddCurrency(BindCurrency(currency));
            }

            return Json(new[] { currency }.ToDataSourceResult(request, ModelState));
        }
Ejemplo n.º 5
0
 private Currency BindCurrency(CurrencyViewModel currencyViewModel)
 {
     if (currencyViewModel == null) return null;
     var currency = new Currency()
     {
         CurrencyID = currencyViewModel.CurrencyID,
         Code = currencyViewModel.CurrencyCode,
         //CommodityID = contributionDetailViewModel.CommodityID,
         Name = currencyViewModel.CurrencyName
     };
     return currency;
 }