public List <tinhhinhhoatdongcuatour> tinhhinhhoatdong() { List <tinhhinhhoatdongcuatour> thhdct = new List <tinhhinhhoatdongcuatour>(); var tours = db3.GetAll(); foreach (tour t in tours) { tinhhinhhoatdongcuatour th = new tinhhinhhoatdongcuatour(); th.tentour = t.tentour; var doandulichs = db.Find(c => c.idtour == t.id); th.soluongdoandulich = doandulichs.Count(); th.tongchiphi = tkcpbus.tongchiphi(doandulichs); th.tong = tongdoanhthu(t.id); th.tongdoanhthu = th.tong - th.tongchiphi; thhdct.Add(th); } return(thhdct); }
public List <tinhhinhhoatdongcuatour> tinhhinhhoatdong() { List <tinhhinhhoatdongcuatour> thhdct = new List <tinhhinhhoatdongcuatour>(); var tour = db.tours.ToList(); foreach (tour t in tour) { tinhhinhhoatdongcuatour th = new tinhhinhhoatdongcuatour(); th.tentour = t.tentour; var doan = db.doanduliches.Where(o => o.idtour == t.id); th.soluongdoandulich = doan.Count(); th.tongchiphi = tkcpb.tongchiphi(doan); th.tong = tongdoanhthu(t.id); th.tongdoanhthu = th.tong - th.tongchiphi; thhdct.Add(th); } return(thhdct); }