public IActionResult List(string kind_of_emotion, bool inside) { if (inside == true && !string.IsNullOrEmpty(kind_of_emotion)) { var activities = ActivityRepo.GetAll(); var attributes = ActivityAttributeRepo.GetAll(); attributes = attributes .Include(a => a.Emotion) .Include(a => a.Activity) .Where(i => i.Emotion.EmotionName == kind_of_emotion && i.InInside == true); return(View( new ActivityListModel() { Activities = activities, ActivityAttributes = attributes })); } else if (inside == false && !string.IsNullOrEmpty(kind_of_emotion)) { var activities = ActivityRepo.GetAll(); var attributes = ActivityAttributeRepo.GetAll(); attributes = attributes .Include(a => a.Emotion) .Include(a => a.Activity) .Where(i => i.Emotion.EmotionName == kind_of_emotion && i.InInside == false); return(View( new ActivityListModel() { Activities = activities, ActivityAttributes = attributes })); } else { var activities = ActivityRepo.GetAll(); return(View( new ActivityListModel() { Activities = activities })); } }
public IViewComponentResult Invoke() { var activities = ActivityRepo.GetAll(); var attributes = ActivityAttributeRepo.GetAll(); attributes = attributes .Include(a => a.Emotion) .Include(a => a.Activity) .Where(i => i.EmotionID == 1); return(View( new ActivityListModel() { Activities = activities, ActivityAttributes = attributes })); }