public AuctionListSingleElemVM(AuctionModel auctionModel, string currency, ICurrencyExchangeRepository exchangeRepository) { Id = auctionModel.Id; AuctionTitle = auctionModel.Title; var priceExchanged = exchangeRepository .GetValueInAnotherCurrency(auctionModel.EndingPrice, auctionModel.Currency, currency); if (priceExchanged != null) { ActualPrice = priceExchanged.ToString(); Currency = currency; } else { ActualPrice = auctionModel.EndingPrice.ToString(); Currency = auctionModel.Currency; } CreatorName = UserHelper.GetUserNameById(auctionModel.CreatorId); CreatorId = auctionModel.CreatorId; ShortDescription = auctionModel.Description; DateCreated = auctionModel.DateCreated.ToString(); DateEnd = (auctionModel.DateCreated.AddDays(auctionModel.ExpiresIn)).ToString(); AuctionUrl = "~/AuctionDetails?ID=" + Id; IsEnded = auctionModel.IsEnded; }
public AuctionDetailsViewModel LoadAuction(string ID, string currency, ICurrencyExchangeRepository currencyExchangeRepository) { try { //TODO auctionRepo.CheckIfAuctionEnded(ID); auctionRepo.CheckIfEndingPriceIsOk(bidsRepo.GetMaxBidOfAuction(ID)); var auction = auctionRepo.GetSingleElementByID(ID); var startPrice = currencyExchangeRepository.GetValueInAnotherCurrency(auction.StartPrice, auction.Currency, currency); var endingPrice = currencyExchangeRepository.GetValueInAnotherCurrency(auction.EndingPrice, auction.Currency, currency); var bids = bidsRepo.GetBidsByAuctionID(ID); var bidsVM = new AuctionBidsViewModel(bids, currency, auction.Currency, currencyExchangeRepository); if (endingPrice != null && startPrice != null) { auction.EndingPrice = (decimal)endingPrice; auction.StartPrice = (decimal)startPrice; auction.Currency = currency; } var img = imageRepo.GetImagesByAuctionID(ID).ToList(); return(new AuctionDetailsViewModel(auction, bidsVM, img)); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return(null); } }
public HomeController(ICurrencyExchangeRepository repo) { this.repo = repo; }
public CurrencyExchangeService(ICurrencyExchangeRepository repository, ICurrencyRepository currencyRepository) { _repository = repository; _currencyRepository = currencyRepository; }
public Handler(ICurrencyExchangeRepository currencyExchangeRepository) { _currencyExchangeRepository = currencyExchangeRepository; }
public CurrencyExchangeService(ApplicationDbContext context) : base(context) { IRepositoriesFactory repositoriesFactory = new RepositoriesFactory(); _currencyExchange = repositoriesFactory.CreateCurrencyExchangeRepository(); }
public ExchangeService(ICurrencyExchangeRepository currencyExchangeRepository) { _currencyExchangeRepository = currencyExchangeRepository; }
public CurrencyExchangeRepositoryTest() { _ICurrencyExchangeRepository = new CurrencyExchangeRepository(StubbingExchangeRateAPI()); }
// public UsersController(CurrencyExchangeContext context, // CurrencyExchangeRepository repo, // IMapper mapper) public UsersController(ICurrencyExchangeRepository repo) { _repo = repo; }
public AuctionBidsViewModel(IEnumerable <BidsModel> bids, string baseCurrency, string targetCurrency, ICurrencyExchangeRepository currencyExchangeRepository) { bidsViewModel = new List <AuctionBidViewModel>(); foreach (var item in bids) { //TODO currency var endingPrice = currencyExchangeRepository.GetValueInAnotherCurrency(item.Value, baseCurrency, targetCurrency); if (endingPrice != null) { item.Value = (decimal)endingPrice; } bidsViewModel.Add(new AuctionBidViewModel(item)); } }