Ejemplo n.º 1
0
 public StoresController
 (
     MarketUserService marketUserService,
     MarketStoreGeneralService marketStoreGeneralService,
     MarketProductsService marketProductsService
 )
 {
     MarketUserService         = marketUserService;
     MarketStoreGeneralService = marketStoreGeneralService;
     MarketProductsService     = marketProductsService;
 }
 public HistoryController
 (
     MarketGeneralService marketGeneralService,
     MarketStoreGeneralService marketStoreGeneralService,
     MarketUserService marketUserService
 )
 {
     MarketGeneralService      = marketGeneralService;
     MarketStoreGeneralService = marketStoreGeneralService;
     MarketUserService         = marketUserService;
 }
Ejemplo n.º 3
0
        public async Task <ActionResult <StoreRefDTO> > Create([FromBody] StoreCreateDTO storeCreationDTO)
        {
            object?[] values =
            {
                storeCreationDTO.StoreName,
                storeCreationDTO.Username,
                storeCreationDTO.CreditCard?.CardNumber,
                storeCreationDTO.CreditCard?.Month,
                storeCreationDTO.CreditCard?.Year,
                storeCreationDTO.CreditCard?.HolderName,
                storeCreationDTO.CreditCard?.Cvv,
                storeCreationDTO.CreditCard?.HolderId,
                storeCreationDTO.Address?.State,
                storeCreationDTO.Address?.City,
                storeCreationDTO.Address?.Street,
                storeCreationDTO.Address?.ApartmentNumber,
                storeCreationDTO.Address?.ZipCode,
            };
            if (values.Contains(null))
            {
                return(BadRequest("Missing parameter values"));
            }

            StoreData storeData = await MarketStoreGeneralService.CreateStoreAsync
                                  (
                storeCreationDTO.StoreName,
                storeCreationDTO.Username,
                storeCreationDTO.CreditCard?.CardNumber,
                storeCreationDTO.CreditCard?.Month,
                storeCreationDTO.CreditCard?.Year,
                storeCreationDTO.CreditCard?.HolderName,
                storeCreationDTO.CreditCard?.Cvv,
                storeCreationDTO.CreditCard?.HolderId,
                storeCreationDTO.Address?.State,
                storeCreationDTO.Address?.City,
                storeCreationDTO.Address?.Street,
                storeCreationDTO.Address?.ApartmentNumber,
                storeCreationDTO.Address?.ZipCode
                                  );

            if (storeData is null)
            {
                return(InternalServerError());
            }

            return(Ok(new StoreRefDTO
            {
                Id = storeData.Id,
                Name = storeData.Name,
            }));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <StoreRefDTO> > Info([FromQuery] Guid storeId)
        {
            StoreData?store = await MarketStoreGeneralService.getStoreById(storeId);

            if (store == null)
            {
                return(InternalServerError());
            }

            return(Ok(new StoreRefDTO
            {
                Id = store.Id,
                Name = store.Name,
            }));
        }
        public async Task <ActionResult <IEnumerable <HistoryRecordDTO> > > OfStore([FromBody] StoreInfoActionDTO storeInfoActionDTO)
        {
            if (string.IsNullOrWhiteSpace(storeInfoActionDTO.Username))
            {
                return(BadRequest("Invalid username"));
            }

            ICollection <HistoryData>?result = await MarketStoreGeneralService.GetStoreHistory(storeInfoActionDTO.Username, storeInfoActionDTO.StoreId);

            if (result == null)
            {
                return(InternalServerError());
            }

            return(Ok(result.Select(HistoryRecordDTO.FromHistoryData)));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult <StoreInfoWithProductsDTO> > InfoWithProducts([FromQuery] Guid storeId)
        {
            StoreData?store = await MarketStoreGeneralService.getStoreById(storeId);

            if (store == null)
            {
                return(InternalServerError());
            }

            return(Ok(new StoreInfoWithProductsDTO
            {
                Id = store.Id,
                Name = store.Name,
                Products = store.Products.Select(ProductDTO.FromProductData),
            }));
        }
 private MarketBridgeAdapter
 (
     SystemContext systemContext,
     MarketStoreGeneralService marketStoreGeneralService,
     MarketProductsService marketProductsService,
     MarketShoppingCartService marketShoppingCartService,
     MarketGeneralService marketGeneralService,
     MarketUserService marketUserService,
     MarketStorePermissionsManagementService marketStorePermissionsManagementService
 )
     : base(systemContext)
 {
     this.marketStoreGeneralService = marketStoreGeneralService;
     this.marketProductsService     = marketProductsService;
     this.marketShoppingCartService = marketShoppingCartService;
     this.marketGeneralService      = marketGeneralService;
     this.marketUserService         = marketUserService;
     this.marketStorePermissionsManagementService = marketStorePermissionsManagementService;
 }
        public async Task <ActionResult <HistoryRecordDTO> > OfStoreSpecific([FromBody] StoreHistorySpecificDTO storeHistorySpecificDTO)
        {
            if (string.IsNullOrWhiteSpace(storeHistorySpecificDTO.Username))
            {
                return(BadRequest("Invalid username"));
            }
            if (string.IsNullOrWhiteSpace(storeHistorySpecificDTO.PaymentId))
            {
                return(BadRequest("Invalid payment ID"));
            }

            ICollection <HistoryData>?result = await MarketStoreGeneralService.GetStoreHistory(storeHistorySpecificDTO.Username, storeHistorySpecificDTO.StoreId);

            if (result == null)
            {
                return(InternalServerError());
            }

            return(SingleHistory(storeHistorySpecificDTO.PaymentId, result));
        }
Ejemplo n.º 9
0
        public async Task <ActionResult <IEnumerable <StoreRefDTO> > > Search([FromBody] StoreNameDTO storeNameDTO)
        {
            if (string.IsNullOrWhiteSpace(storeNameDTO.StoreName))
            {
                return(BadRequest("Invalid store name"));
            }

            ICollection <StoreData>?stores = await MarketStoreGeneralService.FindStoresByName(storeNameDTO.StoreName);

            if (stores is null)
            {
                return(InternalServerError());
            }

            return(Ok(stores.Select(store => new StoreRefDTO
            {
                Id = store.Id,
                Name = store.Name,
            })));
        }
 public StoreBidsController(MarketBidsService marketBidsService, MarketStoreGeneralService marketStoreGeneralService)
 {
     MarketBidsService         = marketBidsService;
     MarketStoreGeneralService = marketStoreGeneralService;
 }