public List <string> GetDailyActivityAutoComplete(long PlayerID, enumDailyActivityTypes ActivityType) { List <string> ListOfData = new List <string>(); if (ActivityType == enumDailyActivityTypes.Breakfast) { ListOfData = db.PlayerDailyActivities.Where(m => m.PlayerID == PlayerID).Select(m => m.Breakfast).Distinct().ToList(); } else if (ActivityType == enumDailyActivityTypes.Lunch) { ListOfData = db.PlayerDailyActivities.Where(m => m.PlayerID == PlayerID).Select(m => m.Lunch).Distinct().ToList(); } else if (ActivityType == enumDailyActivityTypes.Dinner) { ListOfData = db.PlayerDailyActivities.Where(m => m.PlayerID == PlayerID).Select(m => m.Dinner).Distinct().ToList(); } else if (ActivityType == enumDailyActivityTypes.Snacks) { ListOfData = db.PlayerDailyActivities.Where(m => m.PlayerID == PlayerID).Select(m => m.Snacks).Distinct().ToList(); } return(ListOfData); }
public ActionResult GetDailyActivityAutoComplete(string id, long paramPlayerID, enumDailyActivityTypes activityType) { PlayerDailyActivityRepository playerDailyActivityRepo = new PlayerDailyActivityRepository(); var data = playerDailyActivityRepo.GetDailyActivityAutoComplete(paramPlayerID, activityType); return(Json(data, JsonRequestBehavior.AllowGet)); }