public List <ViewModels.BargainSuccessViewModel> GetAllOnSaleReport(long user_id) { var tmp = _mydb.BargainSuccess.Where(x => x.Price2 == 0 && x.OnSale && x.UserBargain_Id_1 == user_id).OrderByDescending(x => x.Id).ToList(); List <BargainSuccessViewModel> bargainSuccessViewModel_list = new List <BargainSuccessViewModel>(); utility.UtilityRepository utility = new utility.UtilityRepository(); foreach (BargainSuccess item in tmp) { BargainSuccessViewModel successViewModel = new BargainSuccessViewModel(); successViewModel.Date = utility.Convert2Shamsi(item.DateTime); successViewModel.FullName1 = item.FirstUserBargain_1.Name + " " + item.FirstUserBargain_1.Family; successViewModel.FullName2 = item.SecendUserBargain_2.Name + " " + item.SecendUserBargain_2.Family; successViewModel.Id = item.Id; successViewModel.Price = item.SellBuy.Price; successViewModel.Sod = item.Sod; if (item.SellBuyType_Id == 1) { successViewModel.Type = "فروش"; } else { successViewModel.Type = "خرید"; } successViewModel.NowMazane = item.NowMazane; bargainSuccessViewModel_list.Add(successViewModel); } return(bargainSuccessViewModel_list); }
public List <ViewModels.BargainSuccessViewModel> GetAllCloseBag(DateTime dateStart, DateTime dateEnd) { var tmp = _mydb.BargainSuccess.Where(x => x.Price2 > 0 && (x.DateTime >= dateStart && x.DateTime <= dateEnd)).OrderByDescending(x => x.Id).ToList(); List <BargainSuccessViewModel> bargainSuccessViewModel_list = new List <BargainSuccessViewModel>(); ComisonRepository comisonRepository = new ComisonRepository(); utility.UtilityRepository utility = new utility.UtilityRepository(); foreach (BargainSuccess item in tmp) { BargainSuccessViewModel successViewModel = new BargainSuccessViewModel(); successViewModel.Date = utility.Convert2Shamsi(item.DateTime); successViewModel.Tasvie = utility.Convert2Shamsi(item.Tasvie); successViewModel.FullName1 = item.FirstUserBargain_1.Name + " " + item.FirstUserBargain_1.Family; successViewModel.FullName2 = item.SecendUserBargain_2.Name + " " + item.SecendUserBargain_2.Family; successViewModel.Id = item.Id; successViewModel.Price = item.SellBuy.Price; successViewModel.Price2 = item.Price2; successViewModel.Sod = item.Sod; successViewModel.TypeID = item.SellBuyType_Id; successViewModel.Comision = comisonRepository.Get(item).Price; if (item.SellBuyType_Id == 1) { successViewModel.Type = "فروش"; } else { successViewModel.Type = "خرید"; } successViewModel.NowMazane = item.NowMazane; bargainSuccessViewModel_list.Add(successViewModel); } return(bargainSuccessViewModel_list); }