Ejemplo n.º 1
0
 public ProductsController(IProducts assets, DBModel context, UserManager <UserAccount> userManager, SignInManager <UserAccount> signInManager, IWishlist wishlist)
 {
     _assets        = assets;
     _context       = context;
     _userManager   = userManager;
     _signInManager = signInManager;
     _wishlist      = wishlist;
 }
 public UnitOfWork(DbContext context)
 {
     this.Context           = context;
     user                   = new UsersRepo(Context);
     products               = new ProductsRepo(Context);
     productdetails         = new ProductDetailsRepo(Context);
     productsproductdetails = new ProductProductDetailsRepo(Context);
 }
 /// <param name='operations'>
 /// Reference to the ZtherApiIntegration.API.IProducts.
 /// </param>
 /// <param name='code'>
 /// Required.
 /// </param>
 public static SizeList GetAllSizeByProduct(this IProducts operations, string code)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IProducts)s).GetAllSizeByProductAsync(code);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 /// <param name='operations'>
 /// Reference to the ZtherApiIntegration.API.IProducts.
 /// </param>
 /// <param name='code'>
 /// Required.
 /// </param>
 /// <param name='sizeCategory'>
 /// Required.
 /// </param>
 public static ColorList GetAllColorByProductAndSizeCategory(this IProducts operations, string code, string sizeCategory)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IProducts)s).GetAllColorByProductAndSizeCategoryAsync(code, sizeCategory);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
 public Warehouse(string folder)
 {
     Directory.CreateDirectory(folder);
     Customers = new CustomerCatalogue(folder);
     Products  = new ProductCatalogue(folder);
     Orders    = new OrderCatalogue(folder);
     UpdateOrderReferences(); // Uppdatera referenser för kunder och och produkter för ordrar.
 }
Ejemplo n.º 6
0
 public Category(IProducts products, IProducers producers, IMaterials material, ITypeOfProducts types, IProductModels models)
 {
     _material  = material;
     _types     = types;
     _models    = models;
     _producers = producers;
     _products  = products;
 }
Ejemplo n.º 7
0
 public AuctionController(DBModel context, UserManager <UserAccount> userManager, SignInManager <UserAccount> signInManager, IEmailSender emailSender, IProducts assets, IAuction auction)
 {
     _context       = context;
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _assets        = assets;
     _auction       = auction;
 }
Ejemplo n.º 8
0
 public HomeController(ISubCategories subCategories, ITypeOfProducts type, IProducts products, IUsers users, IProducers producers, IProductImages productImages)
 {
     _products      = products;
     _users         = users;
     _producers     = producers;
     _productImages = productImages;
     _type          = type;
     _subCategories = subCategories;
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            ProductsFactory product = new ProductsFactory();

            IProducts orange = product.CreateProduct("orange");


            Console.ReadKey();
        }
    public SaveQuoteCommandHandlerTests()
    {
        _customers  = NSubstitute.Substitute.For <ICustomers>();
        _products   = NSubstitute.Substitute.For <IProducts>();
        _quotes     = NSubstitute.Substitute.For <IQuotes>();
        _unitOfWork = NSubstitute.Substitute.For <IEcommerceUnitOfWork>();

        _unitOfWork.Customers.ReturnsForAnyArgs(_customers);
        _unitOfWork.Products.ReturnsForAnyArgs(_products);
        _unitOfWork.Quotes.ReturnsForAnyArgs(_quotes);
    }
Ejemplo n.º 11
0
        public void LoadProduct(IProducts product)
        {
            //TODO

            if (isFull)
            {
                throw new InvalidOperationException("Vehicle is full!");
            }

            trunk.Add(product);
        }
Ejemplo n.º 12
0
 public ProductController(
     IMapper mapper,
     IProducts products,
     IProductInsertService productService,
     IProductPagination productPagination)
 {
     _mapper            = mapper;
     _products          = products;
     _productService    = productService;
     _productPagination = productPagination;
 }
    public PlaceOrderCommandHandlerTests()
    {
        _customers         = NSubstitute.Substitute.For <ICustomers>();
        _products          = NSubstitute.Substitute.For <IProducts>();
        _quotes            = NSubstitute.Substitute.For <IQuotes>();
        _currencyConverter = Substitute.For <ICurrencyConverter>();
        _unitOfWork        = NSubstitute.Substitute.For <IEcommerceUnitOfWork>();

        _unitOfWork.Customers.ReturnsForAnyArgs(_customers);
        _unitOfWork.Products.ReturnsForAnyArgs(_products);
        _unitOfWork.Quotes.ReturnsForAnyArgs(_quotes);
    }
Ejemplo n.º 14
0
        public IProducts Unload()
        {
            if (isEmpty)
            {
                throw new InvalidOperationException("No products left in vehicle!");
            }

            IProducts result = trunk[trunk.Count - 1];

            trunk.RemoveAt(trunk.Count - 1);

            return(result);
        }
        public int Buy(IProducts product, int?totalMoney)
        {
            var     stayAlive = true;
            Display display   = new Display();

            do
            {
                try
                {
                    // Picking 5 because in this assignment the lowest costing product I have costs 5.
                    if (totalMoney < 5)
                    {
                        throw new FormatException($"You do not have enough money to buy {product.Name}.");
                    }
                    else
                    {
                        totalMoney -= product.Cost;
                        product.Bought(product.Name);
                        var choice = Convert.ToChar(Console.ReadKey(true));

                        if (choice == 'y')
                        {
                            product.UseProduct(product.Name);
                            stayAlive = false;
                        }
                        else if (choice == 'n')
                        {
                            stayAlive = false;
                        }
                        else
                        {
                            throw new ArgumentException("You did not pick a valid input. Please try again.");
                        }
                    }
                }
                catch (ArgumentNullException ex)
                {
                    display.ErrorMessage(ex.Message);
                }
                catch (FormatException ex)
                {
                    display.ErrorMessage(ex.Message);
                }
                catch (Exception)
                {
                    display.ErrorMessage("Something went wrong.");
                }
            } while (stayAlive);

            return((int)totalMoney);
        }
Ejemplo n.º 16
0
        public DatabaseTests()
        {
            _connection = new SqliteConnection("Filename=:memory:");
            _connection.Open();

            _db = new StoreDbContext(
                new DbContextOptionsBuilder <StoreDbContext>()
                .UseSqlite(_connection)
                .Options);

            _db.Database.EnsureCreated();

            _products = new InventoryManagement(_db);
        }
Ejemplo n.º 17
0
        public void ShowProductsList(int indx, int writeAear)//Shows products that exists in products list
        {
            Sort SBC = new Sort();

            LstProducts.Sort(SBC);

            if (indx <= LstProducts.Count)
            {
                IProducts p = LstProducts[indx];

                Console.SetCursorPosition(0, writeAear);
                Console.WriteLine("{0,3}  {1,-15} {2,5}", p.Pcode, p.PName, p.PPrice);
                Console.WriteLine("  ");
            }
        }
Ejemplo n.º 18
0
 public AdminController(IHostingEnvironment env, IDimensions dimensions, IProductModels productModels, IMaterials materials, IUsers users, IUserProfiles userProfiles, IProductOrders productOrders, IOrders orders, IProducts products, IProducers producers, ITypeOfProducts type, ISubCategories subCategories)
 {
     _producers     = producers;
     _products      = products;
     _type          = type;
     _subCategories = subCategories;
     _orders        = orders;
     _productOrders = productOrders;
     _users         = users;
     _userProfiles  = userProfiles;
     _dimensions    = dimensions;
     _productModels = productModels;
     _materials     = materials;
     _env           = env;
 }
Ejemplo n.º 19
0
    public EcommerceUnitOfWork(EcommerceDDDContext dbContext,
                               ICustomers customers,
                               IOrders orders,
                               IStoredEvents storedEvents,
                               IProducts products,
                               IPayments payments,
                               IQuotes quotes,
                               IEventSerializer eventSerializer) : base(dbContext)
    {
        Customers    = customers ?? throw new ArgumentNullException(nameof(customers));
        Orders       = orders ?? throw new ArgumentNullException(nameof(orders));
        StoredEvents = storedEvents ?? throw new ArgumentNullException(nameof(storedEvents));
        Products     = products ?? throw new ArgumentNullException(nameof(products));
        Quotes       = quotes ?? throw new ArgumentNullException(nameof(quotes));
        Payments     = payments ?? throw new ArgumentNullException(nameof(payments));

        _eventSerializer = eventSerializer ?? throw new ArgumentNullException(nameof(eventSerializer));
    }
Ejemplo n.º 20
0
 public BagController(IUsers users, IUserProfiles userProfiles, IReviews reviews, IDislikes dislikes, ILikes likes, IDeliveries deliveries, IProductOrders productOrders, ITypeOfProducts type, ISubCategories subCategories, IOrders orders, IDimensions dimensions, IProducts products, IProducers producers, IProductModels productModels, IProductImages productImages, IMaterials materials)
 {
     _products      = products;
     _producers     = producers;
     _productModels = productModels;
     _productImages = productImages;
     _materials     = materials;
     _dimensions    = dimensions;
     _orders        = orders;
     _type          = type;
     _subCategories = subCategories;
     _productOrders = productOrders;
     _deliveries    = deliveries;
     _dislikes      = dislikes;
     _likes         = likes;
     _reviews       = reviews;
     _userProfiles  = userProfiles;
     _users         = users;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the LandauWebAPI class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public LandauWebAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._banners        = new Banners(this);
     this._brands         = new Brands(this);
     this._catalogs       = new Catalogs(this);
     this._colors         = new Colors(this);
     this._contactUs      = new ContactUsOperations(this);
     this._countries      = new Countries(this);
     this._groupOrders    = new GroupOrders(this);
     this._images         = new Images(this);
     this._productImages  = new ProductImages(this);
     this._productReviews = new ProductReviews(this);
     this._products       = new Products(this);
     this._questions      = new Questions(this);
     this._retailers      = new Retailers(this);
     this._seo            = new SeoOperations(this);
     this._signUps        = new SignUps(this);
     this._states         = new States(this);
     this._swatches       = new Swatches(this);
     this._baseUri        = new Uri("http://microsoft-apiapp5dcb282abbf74b72ad1667c2-staging.azurewebsites.net:80");
 }
Ejemplo n.º 22
0
        public string ShowHowToUse(IProducts p)//Sends messges based of products types
        {
            string result = "";

            switch (p.PType)
            {
            case "Drinks":
                result = $"Drink the {p.PName} Please.";
                break;

            case "Snacks":
                result = $"Eat the {p.PName} Please.";
                break;

            case "Foods":
                result = $"Eat the {p.PName} Please.";
                break;

            default:
                break;
            }

            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the LandauPortalWebAPI class.
 /// </summary>
 /// <param name='rootHandler'>
 /// Optional. The http client handler used to handle http transport.
 /// </param>
 /// <param name='handlers'>
 /// Optional. The set of delegating handlers to insert in the http
 /// client pipeline.
 /// </param>
 public LandauPortalWebAPI(HttpClientHandler rootHandler, params DelegatingHandler[] handlers)
     : base(rootHandler, handlers)
 {
     this._banners        = new Banners(this);
     this._brands         = new Brands(this);
     this._cache          = new Cache(this);
     this._catalogs       = new Catalogs(this);
     this._colors         = new Colors(this);
     this._contactUs      = new ContactUsOperations(this);
     this._countries      = new Countries(this);
     this._emailFavorites = new EmailFavorites(this);
     this._groupOrders    = new GroupOrders(this);
     this._images         = new Images(this);
     this._productImages  = new ProductImages(this);
     this._productReviews = new ProductReviews(this);
     this._products       = new Products(this);
     this._questions      = new Questions(this);
     this._retailers      = new Retailers(this);
     this._seo            = new SeoOperations(this);
     this._signUps        = new SignUps(this);
     this._states         = new States(this);
     this._swatches       = new Swatches(this);
     this._baseUri        = new Uri(API_ENDPOINT);
 }
Ejemplo n.º 24
0
 public ProductController(IProducts product)
 {
     _product = product;
 }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <BaseModelProduct> GetAllByProductCodesAsync(this IProducts operations, IList <string> code, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.BaseModelProduct> result = await operations.GetAllByProductCodesWithOperationResponseAsync(code, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='brand'>
        /// Optional.
        /// </param>
        /// <param name='page'>
        /// Optional.
        /// </param>
        /// <param name='pagesize'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <ProductList> GetAllAsync(this IProducts operations, string brand = null, int?page = null, int?pagesize = null, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.ProductList> result = await operations.GetAllWithOperationResponseAsync(brand, page, pagesize, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='model'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <CoordinateList> UpdateAsync(this IProducts operations, string code, ProductUpdate model, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.CoordinateList> result = await operations.UpdateWithOperationResponseAsync(code, model, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
        /// <param name='operations'>
        /// Reference to the ZtherApiIntegration.API.IProducts.
        /// </param>
        /// <param name='code'>
        /// Required.
        /// </param>
        /// <param name='color'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public static async Task <SizeList> GetAllSizeByProductAndColorAsync(this IProducts operations, string code, string color, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            Microsoft.Rest.HttpOperationResponse <ZtherApiIntegration.API.Models.SizeList> result = await operations.GetAllSizeByProductAndColorWithOperationResponseAsync(code, color, cancellationToken).ConfigureAwait(false);

            return(result.Body);
        }
Ejemplo n.º 29
0
 public ProductInsertService(IBrands brands, IProducts products)
 {
     _brands   = brands;
     _products = products;
 }
Ejemplo n.º 30
0
 public CSharpController(UserManager <ApplicationUser> userManager, IProducts products, IBasketItem basketItem)
 {
     _userManager = userManager;
     _products    = products;
     _basketItem  = basketItem;
 }
Ejemplo n.º 31
0
 public OrdersController(IProducts productService, IOrdersService ordersService)
 {
     this.ProductService = productService;
     this.OrdersService = ordersService;
 }
Ejemplo n.º 32
0
 public ProductsController(IProducts IProducts)
 {
     this.IProducts = IProducts;
 }