public async Task <List <GetDealDto> > GetDealByMerchant(MerchantDealDto MerchantDealDto)
        {
            var getDeallist = (from s in this.Repository
                               select new
            {
                s.Id,
                s.MerchantId,
                s.Merchant.Name,
                s.Merchant.Email,
                MerchantStatus = s.Merchant.Users.Status,
                s.DealName,
                s.DealCode,
                s.Country,
                s.EnglishImage,
                s.ArabicImage,
                s.DealURL,
                s.DealDescription,
                s.Status,
                s.StartDate,
                s.EndDate,
            }).Where(m => m.Email == MerchantDealDto.MerchantEmail).OrderBy(m => m.StartDate).ToList();
            DateTime Timezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Presentdate, TimeZoneInfo.Local.Id, MerchantDealDto.CountryTimezone);

            if (MerchantDealDto.Type == "A")
            {
                getDeallist = getDeallist.Where(m => m.Status.Equals(1) && m.MerchantStatus.Equals(1))
                              .Where(m => m.EndDate >= Timezone).ToList();
            }
            else
            {
                getDeallist = getDeallist.Where(m => m.MerchantStatus.Equals(1))
                              .Where(m => m.EndDate <= Timezone).ToList();
            }
            List <GetDealDto> Deallist = new List <GetDealDto>();

            foreach (var Deal in getDeallist)
            {
                GetDealDto DealDto = new GetDealDto();

                DealDto.DealId          = Deal.Id;
                DealDto.MerchantId      = Deal.MerchantId;
                DealDto.MerchantName    = Deal.Name;
                DealDto.DealName        = Deal.DealName;
                DealDto.DealCode        = Deal.DealCode;
                DealDto.Countries       = Deal.Country;
                DealDto.EnglishImage    = Deal.EnglishImage;
                DealDto.ArabicImage     = Deal.ArabicImage;
                DealDto.DealURL         = Deal.DealURL;
                DealDto.DealDescription = Deal.DealDescription;
                DealDto.StartDate       = Deal.StartDate;
                DealDto.EndDate         = Deal.EndDate;
                DealDto.Status          = Deal.Status;
                Deallist.Add(DealDto);
            }

            return(Deallist.ToList());
        }
        public async Task <List <GetDealDto> > GetAllDeal(string Ipcountry, string CountryTimezone)
        {
            var getDeallist = (from s in this.Repository
                               select new
            {
                s.Id,
                s.MerchantId,
                s.Merchant.Name,
                s.Merchant.Email,
                MerchantStatus = s.Merchant.Users.Status,
                s.DealName,
                s.DealCode,
                s.Country,
                s.EnglishImage,
                s.ArabicImage,
                s.DealURL,
                s.DealDescription,
                s.Status,
                s.StartDate,
                s.EndDate,
                s.MerchantDeal,
                s.TimeZone,
            }).Where(m => m.Status.Equals(1) && m.MerchantStatus.Equals(1))
                              .OrderBy(m => m.StartDate).ToList();

            List <GetDealDto> Deallist = new List <GetDealDto>();

            if (Ipcountry.ToUpper() != "NULL" && CountryTimezone.ToUpper() != "NULL")
            {
                int countryID = await _LookupTypeValuesService.GetCountryID(Ipcountry);

                DateTime Timezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Presentdate, TimeZoneInfo.Local.Id, CountryTimezone);
                if (getDeallist.Count > 0)
                {
                    foreach (var Deal in getDeallist)
                    {
                        DateTime StartTimezone = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Deal.StartDate, Deal.TimeZone, CountryTimezone);
                        DateTime ENDTimezone   = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Deal.EndDate, Deal.TimeZone, CountryTimezone);
                        if (StartTimezone <= Timezone && ENDTimezone >= Timezone)
                        {
                            int DealCountries = 0;
                            foreach (var MerchantDeal in Deal.MerchantDeal)
                            {
                                if (MerchantDeal.CountryID == countryID)
                                {
                                    DealCountries++;
                                }
                            }
                            if (DealCountries > 0)
                            {
                                GetDealDto DealDto = new GetDealDto();

                                DealDto.DealId       = Deal.Id;
                                DealDto.MerchantId   = Deal.MerchantId;
                                DealDto.MerchantName = Deal.Name;
                                DealDto.Countries    = Deal.Country;
                                DealDto.EnglishImage = Deal.EnglishImage;
                                DealDto.ArabicImage  = Deal.ArabicImage;
                                if (!string.IsNullOrEmpty(Deal.DealURL))
                                {
                                    if (Deal.DealURL.ToUpper().Contains("HTTP") || Deal.DealURL.ToUpper().Contains("HTTPS"))
                                    {
                                        DealDto.DealURL = Deal.DealURL;
                                    }
                                    else
                                    {
                                        DealDto.DealURL = "http://" + Deal.DealURL;
                                    }
                                }
                                DealDto.DealName        = Deal.DealName;
                                DealDto.DealDescription = Deal.DealDescription;
                                DealDto.StartDate       = Deal.StartDate;
                                DealDto.EndDate         = Deal.EndDate;
                                DealDto.Status          = Deal.Status;
                                Deallist.Add(DealDto);
                            }
                        }
                    }
                }
            }

            return(Deallist.ToList());
        }