public ServiceMerchantController(ServiceMerchantRepository serviceMerchantRepository, ServiceRepository serviceRepository, MerchantRepository merchantRepository) { _serviceMerchantRepository = serviceMerchantRepository; _serviceRepository = serviceRepository; _merchantRepository = merchantRepository; }
public async Task GetTest() { var options = new DbContextOptionsBuilder <JanusContext>() .UseInMemoryDatabase(databaseName: "merchantDb") .Options; using (var context = new JanusContext(options)) { context.Add(new Merchant { Id = 1, Name = "MerchantA", ClientId = "123", ClientSecret = "Megasecret" }); context.SaveChanges(); } using (var newContext = new JanusContext(options)) { var merchantrepo = new MerchantRepository(newContext); var result = await merchantrepo.Get("123"); Assert.AreEqual(1, result.Id); Assert.AreEqual("MerchantA", result.Name); Assert.AreEqual("123", result.ClientId); Assert.AreEqual("Megasecret", result.ClientSecret); } }
public TokenController(ServiceRepository serviceRepository, MerchantRepository merchantRepository, PaymentInstrumentRepository paymentInstrumentRepository, TokenRepository tokenRepository) { _serviceRepository = serviceRepository; _merchantRepository = merchantRepository; _paymentInstrumentRepository = paymentInstrumentRepository; _tokenRepository = tokenRepository; }
public UnitOfWork() { Items = new ItemRepository(); Merchants = new MerchantRepository(); Monsters = new MonsterRepository(); Routes = new RouteRepository(); Towns = new TownRepository(); Elements = new ElementRepository(); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public List <MerchantModel> GetMerchants() { var items = MerchantRepository.GetAll(); if (items != null) { return(items.Select(p => p.ToModel()).ToList()); } return(new List <MerchantModel>()); }
public async Task <Merchant> AddAsync(AddMerchantRequestMessage addMerchantReponse) { var document = new string(addMerchantReponse.Document.Where(c => char.IsDigit(c)).ToArray()); var merchant = new Merchant() { Document = document, Name = addMerchantReponse.Name }; await MerchantRepository.AddAsync(merchant); return(merchant); }
/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public DatatablesView <MerchantModel> GetMerchantsByPaging(DataTablesPaging request) { int total = 0; var pagingItems = MerchantRepository.GetItemsByPaging(request, out total); var items = new List <MerchantModel>(); foreach (var pagingItem in pagingItems) { var item = pagingItem.ToModel(); items.Add(item); } return(new DatatablesView <MerchantModel>(request.Draw, total, pagingItems.Count, items)); }
public async Task <Merchant> GetAsync(int id) { var merchant = await CacheService.GetAsync <Merchant>(id.ToString()); if (merchant != null) { return(merchant); } merchant = await MerchantRepository.GetAsync(id); if (merchant != null) { await CacheService.SetAsync(merchant.Id.ToString(), merchant); } return(merchant); }
public async Task <Merchant> UpdateAsync(int id, UpdateMerchantRequestMessage updateMerchantRequestMessage) { var merchant = await MerchantRepository.GetAsync(id); if (merchant == null) { return(null); } merchant.ChangeDocument(updateMerchantRequestMessage.Document); merchant.ChangeName(updateMerchantRequestMessage.Name); if (!await MerchantRepository.UpdateAsync(merchant)) { throw new Exception($"Erro on update merchant"); } await CacheService.DelAsync(id.ToString()); return(merchant); }
public MerchantsController(IConfiguration configuration) { repo = new MerchantRepository(configuration); }
public async Task <IEnumerable <int> > GetAllKeysAsync() { return(await MerchantRepository.GetAllKeysAsync()); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Save(MerchantModel model) { return(MerchantRepository.Save(model.ToPO())); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public MerchantModel GetMerchant(int id) { var item = MerchantRepository.GetItem(id); return(item.ToModel()); }
public MerchantController(MerchantRepository merchantRepository) { _merchantRepository = merchantRepository; }
public void TestMerchantId() { var merchant = new MerchantRepository(new AzureTableStorage <MerchantEntity>(connectionString, "Merchants", null)).GetAsync("BittellerATM-LykkeDev").Result; Assert.NotNull(merchant); }