I want to calculate a customer age based on his birth date.
public List<ProductView> GetProductsByStoreAndCategoryID(string storeId, string categoryId)
{
Authenticate();
int _storeId = Convert.ToInt32(storeId);
int _categoryId = Convert.ToInt32(categoryId);
//selecting customerid
var _customerId = (from cs in context.customerstores.Where(cs => cs.StoreId == _storeId && cs.IsDefault.Equals(true)) select cs.CustomerId).FirstOrDefault();
//getting customer date of birth for calculating age and excluding regulated product from the list
var _DateOfBirth = (from c in context.customers.Where(c => c.CustomerId == _customerId && c.IsBlocked.Equals(false)) select c.DateOfBirth).FirstOrDefault();
}
Here I am getting the date of birth, after that I want to calculate age based on that date of birth. How to do that?