public static int GetAge(this MAgeProvider map) { DateTime dtNow = DateTime.UtcNow; DateTime dtBorn = table.GetOrCreateValue(map).BirthDate; int age = ((dtNow.Year - dtBorn.Year) * 372 + (dtNow.Month - dtBorn.Month) * 31 + (dtNow.Day - dtBorn.Day)) / 372; return(age); }
public static void SetBirthDate(this MAgeProvider mAgeProvider, DateTime birthDate) { table.GetOrCreateValue(mAgeProvider).BirthDate = birthDate; }