public GeneralReportCrudFactory() { GeneralReportMapperInstance = new GeneralReportMapper(); StoreMapperInstance = new StoreMapper(); GateMapperInstance = new GateMapper(); dao = SqlDao.GetInstance(); }
public IEnumerable <PizzaLib.Store> PizzaReturn() { var query = from e in db.Store select StoreMapper.Map(e); return(query); }
public System.Collections.Generic.List <Store> GetList() { PizzaboxDBContext Context = new PizzaboxDBContext(); StoreMapper Mapper = new StoreMapper(); return(Context.PizzaStores.Select(Mapper.Map).ToList()); }
public IEnumerable <CartLine> GetProductsInAllChains() { StoreProductMapper storeProductsMapper = new StoreProductMapper(); storeProductsMapper.FillStoreProductList(); StoreMapper storeMapper = new StoreMapper(); storeMapper.FillStoreList(); ChainMapper chainMapper = new ChainMapper(); chainMapper.FillChainList(); List <CartLine> productsFromCart = SessionManager.GetCart(Session).Lines.ToList(); foreach (var product in productsFromCart) { var list = storeProductsMapper.StoreProductList .Where(p => p.ProductId == product.Product.ProductId); var list2 = storeMapper.StoreList .Where(p => list.Any(a => a.StoreId == p.StoreId.ToString().PadLeft(3, '0'))); var list3 = chainMapper.ChainList .Where(p => list2.Any(a => a.ChainId == p.ChainId)); if (list3.Count() != chainMapper.ChainList.Count) { productsFromCart = productsFromCart .Where(x => x.Product.ProductId != product.Product.ProductId).ToList(); } } return(productsFromCart); }
public async Task <List <UserItemInfo> > GetUserItemsAsync(string userId, string endPoint, string token) { var apiRequestModel = AuthenticationMapper.MapToApiRequestModel(endPoint, token); var usersItems = await _storeClient.GetUserItemsAsync(apiRequestModel, userId); return(StoreMapper.Map(usersItems)); }
public async Task <bool> EquipItemAsync(EquipItemModel model, string endPoint, string token) { var apiRequestModel = AuthenticationMapper.MapToApiRequestModel(endPoint, token); var requestModel = StoreMapper.Map(model); return(await _storeClient.EquipItemAsync(apiRequestModel, requestModel)); }
public async Task <List <StoreItem> > GetStoreItemsAsync(string filter, string endPoint, string token) { var apiRequestModel = AuthenticationMapper.MapToApiRequestModel(endPoint, token); var storeItems = await _storeClient.GetStoreItemsAsync(apiRequestModel, filter); return(StoreMapper.Map(storeItems)); }
public async Task <ActionResult <IEnumerable <ProductsResponse> > > GetStoreProducts(int id) { var products = await _context.Product .Where(o => o.StoreId == id) .ToListAsync(); return(Ok(products.Select(p => StoreMapper.Parse(p)))); }
public async Task <ActionResult <IEnumerable <StoreResponse> > > GetStore() { var stores = await _context.Store .Include(s => s.Products) .Include(s => s.StoreLocation) .ToListAsync(); return(Ok(stores.Select(s => StoreMapper.Parse(s)))); }
public async Task <IReadOnlyCollection <Store> > GetAll() { await using var context = new MyDbContext(_options); _storeMapper = new StoreMapper(context); var storeDbModels = await context.Stores.ToListAsync(); var stores = (from storeDbModel in storeDbModels select _storeMapper.DbToDomain(storeDbModel)).ToList(); return(stores.AsReadOnly()); }
public AdminController() { _itemConfig = new Configuration.Configurations(); _itemService = _itemConfig.GetItemService(); _itemMapper = new ItemMapper(_itemConfig); _storeService = _itemConfig.GetStoreService(); _storeMapper = new StoreMapper(_itemConfig); _siService = _itemConfig.GetStoreItemService(); _asService = _itemConfig.GetAvailableSizeService(); _pictureService = _itemConfig.GetPictureService(); }
public XMLParser() { productMapper = new ProductMapper(); chainMapper = new ChainMapper(); storeMapper = new StoreMapper(); storeProductMapper = new StoreProductMapper(); storeMapper.FillStoreList(); productMapper.FillProductList(); chainMapper.FillChainList(); storeProductMapper.FillStoreProductList(); }
public List <StoreDAO> GetStores() { var returnList = new List <StoreDAO>(); foreach (var item in data.GetStores()) { returnList.Add(StoreMapper.MapToStoreDAO(item)); } return(returnList); }
public List <StoreDTO> GetStores() { var returnList = new List <StoreDTO>(); foreach (var item in pssc.GetStores()) { returnList.Add(StoreMapper.MapToDTO(item)); } return(returnList); }
public async Task <Store> GetOne(Guid id) { CustomValidator.ValidateId(id); await using var context = new MyDbContext(_options); _storeMapper = new StoreMapper(context); if (Exists(id)) { var storeDbModel = await context.Stores.FindAsync(id); return(_storeMapper.DbToDomain(storeDbModel)); } return(null); }
public async Task <ActionResult <StoreResponse> > GetStore(int id) { var store = await _context.Store .Include(s => s.Products) .Include(s => s.StoreLocation) .Where(s => s.Id == id) .SingleAsync(); if (store == null) { return(NotFound()); } return(Ok(StoreMapper.Parse(store))); }
public List <T> RetrieveStores <T>(string id) { StoreMapper storeMapper = new StoreMapper(); var listStores = new List <T>(); var lstResult = dao.ExecuteQueryProcedure(storeMapper.GetRetrieveStatementStoresByAirportById(id)); var dic = new Dictionary <string, object>(); if (lstResult.Count > 0) { var objs = storeMapper.BuildObjects(lstResult); foreach (var c in objs) { listStores.Add((T)Convert.ChangeType(c, typeof(T))); } } return(listStores); }
public async Task UpdateOne(Store item) { CustomValidator.ValidateObject(item); await using var context = new MyDbContext(_options); _storeMapper = new StoreMapper(context); if (Exists(item.Id)) { var exists = await HasSameNameAndLocationAsync(item); if (!exists) { var enState = context.Stores.Update(_storeMapper.DomainToDb(item)); enState.State = EntityState.Modified; await context.SaveChangesAsync(); } } }
public async Task <IReadOnlyCollection <Product> > GetStoreSpecificProducts(Guid storeId) { CustomValidator.ValidateId(storeId); await using var context = new MyDbContext(_options); _storeMapper = new StoreMapper(context); var storeDbModel = await context.Stores.FindAsync(storeId); var store = _storeMapper.DbToDomain(storeDbModel); var products = new List <Product>(); foreach (var category in store.Categories) { products.AddRange(category.Products); } return(products); }
public async Task <Store> GetStoreOfSpecificProduct(Guid productId) { CustomValidator.ValidateId(productId); await using var context = new MyDbContext(_options); _storeMapper = new StoreMapper(context); var res = await context.StoreProductRelation.FirstOrDefaultAsync(e => e.ProductDbModelId.Equals(productId)); if (res != null) { var storeDbModelId = res.StoreDbModelId; var storeDbModel = await context.Stores.FindAsync(storeDbModelId); return(_storeMapper.DbToDomain(storeDbModel)); } return(null); }
public async Task <ActionResult <StoreResponse> > PostStore(StoreCreateRequest request) { var idEmpleado = 0; var currentUser = HttpContext.User; if (currentUser.HasClaim(c => c.Type == ClaimTypes.NameIdentifier)) { idEmpleado = int.Parse(currentUser.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); } var user = _context.Shopkeeper.Where(a => a.Id == idEmpleado).Single(); var store = StoreMapper.Parse(request); _context.Store.Add(store); await _context.SaveChangesAsync(); user.IdStore = store.Id; _context.Shopkeeper.Update(user); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStore", new { id = store.Id }, StoreMapper.Parse(store))); }
public StoreView GetStoreByID(int storeID) { return(StoreMapper.ToViewEntity(_unitOfWork.StoreRepository.GetById(storeID))); }
public IEnumerable <StoreView> GetAllStores() { return(_unitOfWork.StoreRepository.GetAll().Select(obj => StoreMapper.ToViewEntity(obj))); }
public bool InsertStore(StoreDAO store) { return(data.InsertStore(StoreMapper.MapToStore(store))); }
public void UpdateStore(StoreDto input) { var store = StoreMapper.Map(input); _storeRepository.Update(store); }
public void CreateStore(StoreDto input) { var store = StoreMapper.Map(input); _storeRepository.Add(store); }
public SqlStoreRepository(MyDbContext context) { _context = context; _storeMapper = new StoreMapper(context); }
public IEnumerable <CalculateResultBuilder> BuildResult(List <CartLine> listOfCartItems) { StoreProductMapper storeProductsMapper = new StoreProductMapper(); StoreMapper storeMapper = new StoreMapper(); ChainMapper chainMapper = new ChainMapper(); storeProductsMapper.FillStoreProductList(); storeMapper.FillStoreList(); chainMapper.FillChainList(); List <CalculateResultBuilder> CalculatedList = new List <CalculateResultBuilder>(); List <Product> products = new List <Product>(); List <Chain> chains = new List <Chain>(); List <Store> stores = new List <Store>(); List <StoreProduct> storeProducts = new List <StoreProduct>(); foreach (var item in listOfCartItems) { //TODO: fix if needed Product p = item.Product; p.Quantity = item.Quantity; products.Add(p); } foreach (var product in products) { storeProducts.AddRange(storeProductsMapper.StoreProductList .Where(p => p.ProductId == product.ProductId).ToList()); stores.AddRange(storeMapper.StoreList .Where(p => storeProducts.Any(a => a.StoreId == p.StoreId.ToString().PadLeft(3, '0'))).ToList()); chains.AddRange(chainMapper.ChainList .Where(p => stores.Any(a => a.ChainId == p.ChainId)).ToList()); } chains = chains.GroupBy(x => x.ChainId) .Select(g => g.First()).ToList(); stores = stores.GroupBy(x => x.StoreId) .Select(g => g.First()).ToList(); foreach (var chain in chains) { foreach (var store in stores) { List <Product> newProductList = new List <Product>(); if (chain.ChainId == store.ChainId) { foreach (var storeProduct in storeProducts) { foreach (var item in products) { if (storeProduct.StoreId == store.StoreId.ToString().PadLeft(3, '0')) { if (item.ProductId == storeProduct.ProductId) { Product product = item; product.ProductPrice = storeProduct.ProductPrice * product.Quantity; newProductList.Add(product); } } } } CalculatedList.Add(new CalculateResultBuilder( chain.ChainName, store.StoreName, newProductList .OrderBy(x => x.ProductPrice).ToList(), newProductList .Sum(x => x.ProductPrice))); } } } return(CalculatedList); }
public StoreCrudFactory() : base() { mapper = new StoreMapper(); dao = SqlDao.GetInstance(); }
public HomeController() { _itemConfig = new Configuration.Configurations(); _storeMapper = new StoreMapper(_itemConfig); _itemMapper = new ItemMapper(_itemConfig); }