Beispiel #1
0
        public bool AssignColorToProduct(Product product, int colorId)
        {
            Color color = TheUnitOfWork.Color.GetById(colorId);

            TheUnitOfWork.Product.AssignColorToProduct(product, color);
            return(TheUnitOfWork.Commit() > new int());
        }
Beispiel #2
0
        internal void DecreaseQuantity(int Id, int quantity)
        {
            Product product = GetById(Id);

            product.Quantity -= quantity;
            TheUnitOfWork.Commit();
        }
        public bool Update(OrderHeader OrderHeader)
        {
            TheUnitOfWork.OrderHeader.Update(OrderHeader);
            TheUnitOfWork.Commit();

            return(true);
        }
        public void EmptyCart(string userId)
        {
            var user = FindByID(userId);

            user.Cart.CartProducts = null;
            TheUnitOfWork.Commit();
        }
        public bool UpdateAppointment(Appointment appointment)
        {
            TheUnitOfWork.Appointment.Update(appointment);
            TheUnitOfWork.Commit();

            return(true);
        }
Beispiel #6
0
        public void Insert(AddProductVM ProductViewModel)
        {
            var product = Mapper.Map <Product>(ProductViewModel);

            TheUnitOfWork.Product.Insert(product);
            TheUnitOfWork.Commit();
        }
Beispiel #7
0
        public bool UpdateNotification(Notification notification)
        {
            TheUnitOfWork.Notification.Update(notification);
            TheUnitOfWork.Commit();

            return(true);
        }
        public void MakeOrder(string userId, IEnumerable <CartProduct> cartProducts)
        {
            // make orderHeader and add it to the user
            OrderHeader orderHeader = new OrderHeader()
            {
                OrderDate = DateTime.Now
            };

            userAppService.checkout(userId, orderHeader);
            // every product have order details
            foreach (var carProduct in cartProducts)
            {
                OrderDetails orderDetails = new OrderDetails()
                {
                    Quantity   = carProduct.Quantity,
                    OrderDate  = DateTime.Now,
                    TotalPrice = carProduct.getTotalPrice(),
                    ProductID  = carProduct.Product.ID,
                    OrderID    = orderHeader.ID
                };
                orderDetailsAppService.Insert(orderDetails);
                AddOrderDetails(orderHeader.ID, orderDetails);
                productAppService.DecreaseQuantity(carProduct.Product.ID, carProduct.Quantity);
            }
            TheUnitOfWork.Commit();
        }
        private void AddOrderDetails(int orderHeaderId, OrderDetails orderDetails)
        {
            OrderHeader orderHeader = GetByID(orderHeaderId);

            orderHeader.AddOrder(orderDetails);
            TheUnitOfWork.Commit();
        }
        public bool Update(OrderDetails OrderDetails)
        {
            TheUnitOfWork.OrderDetails.Update(OrderDetails);
            TheUnitOfWork.Commit();

            return(true);
        }
Beispiel #11
0
        public bool UpdateDealer(Dealer dealer)
        {
            TheUnitOfWork.Dealer.Update(dealer);
            TheUnitOfWork.Commit();

            return(true);
        }
        public bool UpdateEmployee(ApplicationUserIdentity employee)
        {
            TheUnitOfWork.Account.Update(employee);
            TheUnitOfWork.Commit();

            return(true);
        }
Beispiel #13
0
        public void Insert(CategoryViewModel categoryViewModel)
        {
            var category = Mapper.Map <Category>(categoryViewModel);

            TheUnitOfWork.Category.Insert(category);
            TheUnitOfWork.Commit();
        }
        public void UpdateQuantity(string cartId, int productId, int quantity)
        {
            CartProduct cartProduct = GetCartProduct(cartId, productId);

            cartProduct.Quantity = quantity;
            TheUnitOfWork.Commit();
        }
        public void Insert(ColorViewModel ColorViewModel)
        {
            var color = Mapper.Map <Color>(ColorViewModel);

            TheUnitOfWork.Color.Insert(color);
            TheUnitOfWork.Commit();
        }
Beispiel #16
0
        public void removeProduct(string userId, int productId)
        {
            Wishlist wishlist = TheUnitOfWork.Wishlist.GetById(userId);
            Product  product  = TheUnitOfWork.Product.GetById(productId);

            wishlist.Products.Remove(product);
            TheUnitOfWork.Commit();
        }
Beispiel #17
0
        public bool UpdateCategroy(CategroyViewModel categroyViewModel)
        {
            var category = Mapper.Map <Category>(categroyViewModel);

            TheUnitOfWork.Category.Update(category);
            TheUnitOfWork.Commit();
            return(true);
        }
Beispiel #18
0
        public void removeProduct(string userId, int productId)
        {
            Cart        cart        = TheUnitOfWork.Cart.GetById(userId);
            CartProduct cartProduct = TheUnitOfWork.CartProduct.GetCartProduct(cart.ID, productId);

            cart.CartProducts.Remove(cartProduct);
            TheUnitOfWork.Commit();
        }
Beispiel #19
0
        public bool DeleteClass(int id)
        {
            bool result = false;

            TheUnitOfWork.Class.Delete(id);
            result = TheUnitOfWork.Commit() > new int();
            return(result);
        }
Beispiel #20
0
        public bool UpdateClass(ClassVM classVM)
        {
            var clas = Mapper.Map <Class>(classVM);

            TheUnitOfWork.Class.Update(clas);
            TheUnitOfWork.Commit();
            return(true);
        }
Beispiel #21
0
        public void addOrderDetails(int productId, int orderDetailsId)
        {
            Product      product      = GetById(productId);
            OrderDetails orderDetails = TheUnitOfWork.OrderDetails.GetById(orderDetailsId);

            TheUnitOfWork.Product.addOrderDetails(product, orderDetails);
            TheUnitOfWork.Commit();
        }
        public bool DeleteProductCart(int id)
        {
            bool result = false;

            TheUnitOfWork.ProductCart.Delete(id);
            result = TheUnitOfWork.Commit() > new int();
            return(result);
        }
        public bool UpdateProduct(ProductViewModel productViewModel)
        {
            var product = Mapper.Map <Product>(productViewModel);

            TheUnitOfWork.Product.Update(product);
            TheUnitOfWork.Commit();
            return(true);
        }
        public bool UpdateMessage(MessageVM messageViewModel)
        {
            var message = Mapper.Map <Message>(messageViewModel);

            TheUnitOfWork.Message.Update(message);
            TheUnitOfWork.Commit();

            return(true);
        }
Beispiel #25
0
        public bool DeleteNotification(string id)
        {
            bool result = false;

            TheUnitOfWork.Notification.Delete(id);
            result = TheUnitOfWork.Commit() > new int();

            return(result);
        }
        public bool DeleteMessage(int id)
        {
            bool result = false;

            TheUnitOfWork.Message.Delete(id);
            result = TheUnitOfWork.Commit() > new int();

            return(result);
        }
        public bool DeleteAppointment(int id)
        {
            bool result = false;

            TheUnitOfWork.Appointment.Delete(id);
            result = TheUnitOfWork.Commit() > new int();

            return(result);
        }
Beispiel #28
0
        public bool UpdateComment(Comment comment)
        {
            var commentss = Mapper.Map <Comment>(comment);

            TheUnitOfWork.Comment.Update(commentss);
            TheUnitOfWork.Commit();

            return(true);
        }
        public ShoppingCart Insert(string id)
        {
            ShoppingCart newSC = TheUnitOfWork.ShoppingCart.Insert(new ShoppingCart {
                ClientId = id
            });

            TheUnitOfWork.Commit();
            return(newSC);
        }
Beispiel #30
0
        public bool UpdateOrder(OrderDetailsViewModel orderViewModel)
        {
            var order = mapper.Map <Order>(orderViewModel);

            TheUnitOfWork.Order.Update(order);
            TheUnitOfWork.Commit();

            return(true);
        }