Esempio n. 1
0
        public IActionResult HuyDonHang(string id)
        {
            DonHang dh = _shopRepo.GetDonHang(id);

            if (dh.TinhTrangDh != 3)
            {
                dh.TinhTrangDh = 0;
                _repository.Update(dh);
                // context.DonHang.Update(dh);

                //context.SaveChanges();
                return(RedirectToAction("ChiTietDonHang", "GioHang", new { id = id }).WithSuccess("Thành công", "Đơn hàng đã được hủy."));
            }
            else
            {
                return(RedirectToAction("ChiTietDonHang", "GioHang", new { id = id }).WithSuccess("Thất bại", "Đơn hàng không thể hủy."));
            }
        }