/// <summary> /// Finds Total Income. /// </summary> /// <param name="supplierName">The supplier name.</param> /// <param name="startDate">Period start date.</param> /// <param name="endDate">Period end date.</param> /// <returns>The total income.</returns> private static decimal? FindTotalIncome(string supplierName, DateTime startDate, DateTime endDate) { using (var northwindDbContext = new NorthwindEntities()) { var totalIncome = northwindDbContext.usp_FindTotalIncome(supplierName, startDate, endDate).First(); return totalIncome; } }
static void Main(string[] args) { using(var context = new NorthwindEntities()) { var result = context.usp_FindTotalIncome(new DateTime(1994, 1, 1), new DateTime(2000, 12, 31), "Exotic Liquids").First(); Console.WriteLine("All Income are {0}",result); } }