public void Setup() { //add currency var britishCurrency = new Entities.Currencies.Currency { Name = "British Pound", Code = "GBP", Format = "£0.00" }; _currencyService.Add(britishCurrency); var taxRate = new TaxRate { Name = "VAT", Code = "S", Percentage = 20m }; _taxRateManager.Add(taxRate); var uk = new Country { Name = "United Kingdom", ISOTwoLetterCode = "GB" }; _countryService.AddCountry(uk); }
public ActionResult <CurrencyDTO> Add([FromBody] CurrencyDTO currencyDTO) { var addedCurrency = _srv.Add(currencyDTO); _unitOfWork.Commit(); return(CreatedAtAction(nameof(GetById), new { id = addedCurrency.Id }, _srv.MapToDTO(addedCurrency))); }
public IActionResult CurrencyAdd(CurrencyDTO model) { if (ModelState.IsValid) { _currencyService.Add(model); } return(RedirectToAction("CurrencyAdd")); }
public JavaScriptResult Create(CurrencyViewModel currencyVm) { try { _currencyService.Add(Mapper.Map <Currency>(currencyVm)); return(JavaScript($"ShowResult('{"Data saved successfully."}','{"success"}','{"redirect"}','{"/APanel/Currency"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public IActionResult Post([FromBody] CurrencyModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = currencyService.Add(model); if (!response.Success) { return(BadRequest(response.Message)); } return(Ok(response.ReturnedId)); }
//public async Task Run(IJobCancellationToken token) //{ // token.ThrowIfCancellationRequested(); // await Process(); //} public async Task Process() { var lists = await _currencyService.GetCurrencyApiCall(); foreach (var itemCurrency in lists) { var currencyItemData = _currencyService.GetCurrencyCode(itemCurrency.Code); if (currencyItemData != null) { itemCurrency.CurrencyId = currencyItemData.CurrencyId; _currencyService.Update(itemCurrency); } else { _currencyService.Add(itemCurrency); } } }
public void AutoAddPopularCoins(int limit) { var topCoins = coinMarketCapClient.TopCoins(limit); var allCoins = currencyService.GetAll(); foreach (var topCoin in topCoins) { if (allCoins.Any(x => x.Ticker == topCoin.Symbol)) { continue; } try { currencyService.Add(topCoin.Symbol, topCoin.Id); currencyService.AddAlternativeName(topCoin.Symbol, topCoin.Id); } catch (Exception e) { Trace.TraceError(e.Message); } } }
public RedirectToRouteResult Add(Currency currency) { _currencyService.Add(currency); return(RedirectToAction("Index")); }
public ActionResult <Currency> Add([FromBody] Currency currency) { return(_currencyService.Add(currency)); }