Advertisement
Guest User

Untitled

a guest
May 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5.  
  6. namespace TeamMVC1.Models
  7. {
  8. public class GioHang
  9. {
  10. webbansachEntities db = new webbansachEntities();
  11. public int iMaSach { get; set; }
  12. public string sTenSach { get; set; }
  13. public string sHinhAnh { get; set; }
  14. public double dDonGia { get; set; }
  15. public int iSoLuong { get; set; }
  16. public double dThanhTien
  17. {
  18. get { return iSoLuong * dDonGia; }
  19. }
  20. //Hàm tạo giỏ hàng
  21. public GioHang(int MaSach )
  22. {
  23. iMaSach = MaSach;
  24. SACH sach = db.SACHes.SingleOrDefault(n => n.MaSach == iMaSach);
  25. sTenSach = sach.TenSach;
  26. sHinhAnh = sach.AnhBia;
  27. dDonGia = double.Parse(sach.GiaBan.ToString());
  28. iSoLuong = 1;
  29. }
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement