public IEnumerable <Goal> SelectGoal() { List <Goal> goalList = new List <Goal>(); IEnumerable <spSelectGoal_Result> goalEFList; using (var context = new RegistrationEntities()) { goalEFList = context.spSelectGoal().ToList(); } foreach (spSelectGoal_Result item in goalEFList) { Goal goal = new Goal(); goal.GoalID = item.GoalID; goal.GoalName = item.GoalName; goal.IsEnabled = item.IsEnabled; goal.CreatedDate = item.CreatedDate; goalList.Add(goal); } return(goalList); }