Anele Ngqandu

Anele Ngqandu

  • 1.3k
  • 429
  • 28.1k

upcoming birthdays starting from current day

Apr 24 2017 8:45 AM
Hi  
 
 I need a quick modification of my query to get upcoming birthdays. Currently I get them but shows passed birthdays of current month. 
 
 
  1. var day = DateTime.Today;  
  2.            // var currentDay = DateTime.Now.Day;  
  3.            var month = day.AddMonths(3);  
  4.            var note = (from cn in _peopleRepository.GetAll()  
  5.                        where cn.PeopleTypeId == 3  
  6.                        && cn.BirthDate.Value.Month >= day.Month && cn.BirthDate.Value.Month <= month.Month  
  7.                        orderby cn.BirthDate.Value.Month, cn.BirthDate.Value.Day  
  8.                        select new GetLandlordBirthdayOutput  
  9.                        {  
  10.                            Id = cn.Id,  
  11.                            FirstName = cn.FirstName,  
  12.                            LastSurname = cn.LastName,  
  13.                            Province = cn.Province,  
  14.                            City = cn.City,  
  15.                            Suburb = cn.Suburb,  
  16.                            Email = cn.EmailAddress,  
  17.                            Phone = cn.CellNumber,  
  18.                            Birthday = cn.BirthDate  
  19.                        }).ToList();  

Answers (4)