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);
        }
        public List <BargainSuccessReportViewModel> GetOnSale_BargainSuccessReportViews(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 <BargainSuccessReportViewModel> bargainSuccessViewModel_list = new List <BargainSuccessReportViewModel>();
            ComisonRepository comisonRepository = new ComisonRepository();

            utility.UtilityRepository utility = new utility.UtilityRepository();
            foreach (BargainSuccess item in tmp)
            {
                BargainSuccessReportViewModel successViewModel = new BargainSuccessReportViewModel();
                successViewModel.Date = utility.Convert2Shamsi(item.DateTime) + " " + item.DateTime.ToShortTimeString();
                successViewModel.Id   = item.Id;

                if (item.SellBuyType_Id == 1)
                {
                    try
                    {
                        successViewModel.Price_Sell = item.SellBuy.Price;
                    }
                    catch
                    {
                        successViewModel.Price_Sell = 0;
                    }
                    try

                    {
                        successViewModel.Price_Buy = item.Price2;
                    }
                    catch
                    {
                        successViewModel.Price_Buy = 0;
                    }
                }
                else
                {
                    try
                    {
                        successViewModel.Price_Sell = item.Price2;
                    }
                    catch
                    {
                        successViewModel.Price_Sell = 0;
                    }
                    try
                    {
                        successViewModel.Price_Buy = item.SellBuy.Price;
                    }
                    catch
                    {
                        successViewModel.Price_Buy = 0;
                    }
                }
                bargainSuccessViewModel_list.Add(successViewModel);
            }
            return(bargainSuccessViewModel_list);
        }