// GET: Admin/DonHangManagement public ActionResult Index(String searchString, int page = 1, int pagesize = 20) { var donHangRepo = new DonHangRepository(); var model = donHangRepo.ListAllPaging(searchString, page, pagesize); return(View(model)); }
public ActionResult ThanhToan(string shipName, string shipMobile, string shipAddress) { var donHang = new DonHang(); donHang.CreateDate = DateTime.Now; donHang.ShipAddress = shipAddress; donHang.ShipMobile = shipMobile; donHang.ShipName = shipName; donHang.TrangThaiDatHang = 1; donHang.TrangThaiDonHang = 1; donHang.TrangThaiGiaoHang = 0; try { var cart = (List <CartItem>)Session[CartSession]; var donHangChiTietRepo = new DonHangChiTietRepository(); decimal total = 0; foreach (var item in cart) { total += (item.Pet.GiaTien.GetValueOrDefault(0) * item.SoLuong); } donHang.TongTien = total; var id = new DonHangRepository().Insert(donHang); foreach (var item in cart) { var donHangChiTiet = new DonHangDetail(); donHangChiTiet.ID_Item = item.Pet.ID_Item; donHangChiTiet.ID_DonHang = id; donHangChiTiet.GiaTien = item.Pet.GiaTien; donHangChiTiet.SoLuong = item.SoLuong; var idItem = donHangChiTietRepo.Insert(donHangChiTiet); } } catch (Exception ex) { Console.WriteLine("ex"); return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public ServiceAccessor(AnhSanPhamRepository anhSanPhamRepository, BannerKhuyenMaiRepository bannerKhuyenMaiRepository, BinhLuanRepository binhLuanRepository, ChiTietDonHangRepository chiTietDonHangRepository, CountryRepository countryRepository, DistrictRepository districtRepository, DonHangRepository donHangRepository, LoaiSpRepository loaiSpRepository, NhaCungCapRepository nhaCungCapRepository, NhaSanXuatRepository nhaSanXuatRepository, ParameterRepository parameterRepository, ProvinceRepository provinceRepository, Core.Repository.SanPhamRepository sanPhamRepository, ThongSoKiThuatRepository thongSoKiThuatRepository, ThongSoRepository thongSoRepository, TraLoiRepository traLoiRepository, TrangThaiDonHangRepository trangThaiDonHangRepository, TrangThaiSanPhamRepository trangThaiSanPhamRepository, VoucherRepository voucherRepository, VoucherTypeRepository voucherTypeRepository, WardRepository wardRepository) { this.anhSanPhamRepository = anhSanPhamRepository; this.bannerKhuyenMaiRepository = bannerKhuyenMaiRepository; this.binhLuanRepository = binhLuanRepository; this.chiTietDonHangRepository = chiTietDonHangRepository; this.countryRepository = countryRepository; this.districtRepository = districtRepository; this.donHangRepository = donHangRepository; this.loaiSpRepository = loaiSpRepository; this.nhaCungCapRepository = nhaCungCapRepository; this.nhaSanXuatRepository = nhaSanXuatRepository; this.parameterRepository = parameterRepository; this.provinceRepository = provinceRepository; this.sanPhamRepository = sanPhamRepository; this.thongSoKiThuatRepository = thongSoKiThuatRepository; this.thongSoRepository = thongSoRepository; this.traLoiRepository = traLoiRepository; this.trangThaiDonHangRepository = trangThaiDonHangRepository; this.trangThaiSanPhamRepository = trangThaiSanPhamRepository; this.voucherRepository = voucherRepository; this.voucherTypeRepository = voucherTypeRepository; this.wardRepository = wardRepository; }
public DataAccess(AnhSanPhamRepository anhSanPhamRepository, BannerKhuyenMaiRepository bannerKhuyenMaiRepository, BinhLuanRepository binhLuanRepository, ChiTietDonHangRepository chiTietDonHangRepository, CountryRepository countryRepository, DistrictRepository districtRepository, DonHangRepository donHangRepository, LoaiSpRepository loaiSpRepository, NhaCungCapRepository nhaCungCapRepository, NhaSanXuatRepository nhaSanXuatRepository, ParameterRepository parameterRepository, ProvinceRepository provinceRepository, Core.Repository.SanPhamRepository sanPhamRepository, ThongSoKiThuatRepository thongSoKiThuatRepository, ThongSoRepository thongSoRepository, TraLoiRepository traLoiRepository, TrangThaiDonHangRepository trangThaiDonHangRepository, TrangThaiSanPhamRepository trangThaiSanPhamRepository, VoucherRepository voucherRepository, VoucherTypeRepository voucherTypeRepository, WardRepository wardRepository) : base(anhSanPhamRepository, bannerKhuyenMaiRepository, binhLuanRepository, chiTietDonHangRepository, countryRepository, districtRepository, donHangRepository, loaiSpRepository, nhaCungCapRepository, nhaSanXuatRepository, parameterRepository, provinceRepository, sanPhamRepository, thongSoKiThuatRepository, thongSoRepository, traLoiRepository, trangThaiDonHangRepository, trangThaiSanPhamRepository, voucherRepository, voucherTypeRepository, wardRepository) { }