Esempio n. 1
0
        public void EditProduct_EqualWithTakedProduct_Test()
        {
            editChange.Change();
            var expected = editChange.GetT();

            Assert.AreEqual(product, expected);
        }
Esempio n. 2
0
        public IActionResult AddProduct(Product product, IFormFile uploadedFile)
        {
            if (uploadedFile != null)
            {
                change = new CreateProduct(new ProductInfo(product, uploadedFile, _appEnvironment.WebRootPath));
                change.Change();
                _unit.GetRepo <Product>().Create(change.GetT());
            }
            else
            {
                _unit.GetRepo <Product>().Create(product);
            }
            _unit.SaveChanges();


            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public IActionResult CreateOrder()
 {
     if (User.Identity.IsAuthenticated)
     {
         if (!(_cart.Lines.Count() == 0))
         {
             var info = new OrderInfo(
                 Guid.Parse(_userManager.GetUserId(User)),
                 _unit.GetRepo <Order>().Get().Count() + 1,
                 _cart);
             change = new CreateOrder(info);
             change.Change();
             _unit.GetRepo <Order>().Create(change.GetT());
             _unit.SaveChanges();
             _cart.Clear();
         }
         return(RedirectToAction("Index", "Shop"));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Esempio n. 4
0
 public void CreateProduct_NotNull()
 {
     createChange.Change();
     Assert.IsNotNull(editChange.GetT());
 }