public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Product product = _productRepository.GetDetails(id);

            if (product == null)
            {
                return(HttpNotFound());
            }
            return(View(product));
        }
Пример #2
0
        // GET: Cart/Return
        public ActionResult Return(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            _orderProductRepository = new OrderProductRepository(new Data.DAL.Context.ApplicationDbContext());
            OrderProduct orderProduct = _orderProductRepository.GetDetails(id);

            orderProduct.Quantity -= 1;

            if (orderProduct.Quantity == 0)
            {
                _orderProductRepository.Delete(id.GetValueOrDefault());
            }
            else
            {
                _orderProductRepository.Update(orderProduct);
            }
            _orderProductRepository.Save();

            return(RedirectToAction("Index"));
        }