public dynamic GetAllCurrency() { CurrencyRepository repo = new CurrencyRepository(); var currency = repo.GetAll(); return(currency); }
public List <CurrencyVM> GetAllCurrencies() { List <Currency> currencies = currencyRepository.GetAll().ToList(); List <CurrencyVM> currencyVMs = new List <CurrencyVM>(); Mapper.Map(currencies, currencyVMs); return(currencyVMs); }
public void CanLoadCurrency() { var repo = new CurrencyRepository(); var currencies = repo.GetAll().ToList(); Assert.AreEqual(2, currencies.Count()); Assert.AreEqual("World Dollars", currencies[0].CurrencyName); }
public ActionResult Edit(ItemEditViewModel model) { if (ModelState.IsValid) { var repo = new PirateItemRepository(); try { var oldItemInfo = repo.GetById(model.Item.ItemId); if (model.ImageUpload != null && model.ImageUpload.ContentLength > 0) { var savepath = Server.MapPath("~/Images"); string fileName = Path.GetFileNameWithoutExtension(model.ImageUpload.FileName); string extension = Path.GetExtension(model.ImageUpload.FileName); var filePath = Path.Combine(savepath, fileName + extension); int counter = 1; while (System.IO.File.Exists(filePath)) { filePath = Path.Combine(savepath, fileName + counter.ToString() + extension); counter++; } model.ImageUpload.SaveAs(filePath); model.Item.ItemPictureURL = Path.GetFileName(filePath); var oldPath = Path.Combine(savepath, fileName + counter.ToString() + extension); if (System.IO.File.Exists(oldPath)) { System.IO.File.Delete(oldPath); } } else { model.Item.ItemPictureURL = oldItemInfo.ItemPictureURL; } repo.Update(model.Item); return(RedirectToAction("Inventory", "Admin")); } catch (Exception ex) { throw ex; } } else { var currenciesRepo = new CurrencyRepository(); model.Currencies = new SelectList(currenciesRepo.GetAll(), "CurrencyId", "CurrencyName"); var categoriesRepo = new CategoryRepository(); model.Categories = new SelectList(categoriesRepo.GetAll(), "CategoryId", "CategoryName"); return(View(model)); } }
public ActionResult AddItem() { var model = new ItemAddViewModel(); var currenciesRepo = new CurrencyRepository(); var categoriesRepo = new CategoryRepository(); model.Currencies = new SelectList(currenciesRepo.GetAll(), "CurrencyName", "CurrencyName"); model.Categories = new SelectList(categoriesRepo.GetAll(), "CategoryName", "CategoryName"); model.Item = new Item(); return(View(model)); }
private void SaveNewCurrencies() { var currencies = _currencyRepository.GetAll(); var receivedCurrencies = source.Currencies.Select(c => new Currency(c.Code, c.Title)).ToList(); receivedCurrencies.RemoveAll(b => currencies.Contains(b)); if (receivedCurrencies.Count > 0) { _currencyRepository.SaveAll(receivedCurrencies); } }
public ActionResult EditItem(int id) { var model = new ItemEditViewModel(); var currenciesRepo = new CurrencyRepository(); var categoriesRepo = new CategoryRepository(); var ItemRepo = new PirateItemRepository(); model.Currencies = new SelectList(currenciesRepo.GetAll(), "CurrencyId", "CurrencyName"); model.Categories = new SelectList(categoriesRepo.GetAll(), "CategoryId", "CategoryName"); model.Item = ItemRepo.GetItemById(id); return(View(model)); }
public async Task <IActionResult> Get(CancellationToken cancellationToken = default) { Uri uri = Request.GetUri(); var host = HttpContext.Connection.RemoteIpAddress; _logger.LogInformation("URI is {uri} and remote ip is {host}", uri, host); IReadOnlyCollection <Currency> allCurrencies = await _currencyRepository.GetAll(cancellationToken); IEnumerable <ViewModel.v1.Currency> viewModels = _mapper.Map <IEnumerable <ViewModel.v1.Currency> >(allCurrencies); return(Ok(viewModels)); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; bc.Commont.initRadComboBox(ref rcbCustomerID, "CustomerName", "CustomerID", DataProvider.DataTam.B_BCUSTOMERS_GetAll()); // CurrencyRepository cr = new CurrencyRepository(); Util.LoadData2RadCombo(rcbCurrentcy, cr.GetAll().ToList(), "Code", "Code", "-Select Currency-", false); // ProduceLineRepository pr = new ProduceLineRepository(); Util.LoadData2RadCombo(rcbProductLine, pr.LoadProductLineList("6").ToList(), "Description", "Description", "-Select Product Line-", true); if (!string.IsNullOrEmpty(Request.QueryString["tid"])) { tbDepositCode.Text = Request.QueryString["tid"]; loadDetail(); } else LoadNewsID(); }
private void InitializeDataSource() { m_partGroupList = r_prtGrp.GetAll(); partGroupkryptonComboBox1.DataSource = m_partGroupList; m_unitList = r_unit.GetAll(); unitkryptonComboBox2.DataSource = m_unitList; m_currencyList = r_ccy.GetAll(); currencykryptonComboBox3.DataSource = m_currencyList; costMethodekryptonComboBox4.DataSource = Enum.GetValues(typeof(CostMethod)); m_partCategoryList = r_prtCat.GetAll(); partCategorykryptonComboBox5.DataSource = m_partCategoryList; Utils.GetListCode(ConvUnit.Items, r_unit.GetAll()); m_taxList = r_tax.GetAll(); taxkryptonComboBox1.DataSource = m_taxList; m_priceCatList = r_priceCat.GetAll(); pricecatkryptonComboBox1.DataSource = m_priceCatList; }
public IEnumerable <Currency> GetCurrencies() { return(currencyRepository.GetAll().Select(c => c.AutoMapObject <DB.Currency, Currency>())); }
public IList <Currency> GetAll() { return(new List <Currency>(_repository.GetAll())); }
public IEnumerable <Currency> Get() { return(CurrencyRepository.GetAll()); }