public async Task <RedirectToActionResult> AddToShoppingCart(int id)
        {
            var selectedCake = await _cakeRepository.Get(id);

            if (selectedCake != null)
            {
                _shoppingCartRepository.AddToCart(selectedCake, 1);
            }

            return(RedirectToAction("GetCartItems"));
        }
        public IActionResult ViewCake(int id)
        {
            var cake = cakeRepository.Get(id);

            if (cake == null || cake.IsDeleted == true)
            {
                return(RedirectToAction("Error"));
            }
            ViewBag.Category = categoryRepository.Get(cake.CategoryId);
            return(View(cake));
        }
        public async Task <ActionResult <Cake> > GetCake(int id)
        {
            var cake = await _cakeRepo.Get(id);

            if (cake == null)
            {
                return(NotFound());
            }

            return(cake);
        }
Beispiel #4
0
        public IActionResult Edit(int id)
        {
            var student     = studentRepository.Get(id);
            var editStudent = new HomeEditViewModel()
            {
                Id = student.Id,

                nameCake  = student.nameCake,
                ThanhPhan = student.ThanhPhan,

                Hsd        = student.Hsd,
                Nsx        = student.Nsx,
                GiaBan     = student.GiaBan,
                DaXoa      = student.DaXoa,
                CategoryId = student.CategoryId
            };

            ViewBag.Category = GetClasses();
            return(View(editStudent));
        }