public ActionResult <List <Group> > PreviewFilterChanges(Filter.FullFilter filter) { SVR_GroupFilter gf = filter.ToServerModel(); gf.CalculateGroupsAndSeries(); if (!gf.GroupsIds.ContainsKey(User.JMMUserID)) { return(new List <Group>()); } return(gf.GroupsIds[User.JMMUserID].Select(a => RepoFactory.AnimeGroup.GetByID(a)) .Where(a => a != null).GroupFilterSort(gf).Select(a => new Group(HttpContext, a)).ToList()); }
public ActionResult <Filter> SaveFilter(Filter.FullFilter filter) { SVR_GroupFilter gf = null; if (filter.IDs.ID != 0) { gf = RepoFactory.GroupFilter.GetByID(filter.IDs.ID); if (gf == null) { return(BadRequest("No Filter with ID")); } } gf = filter.ToServerModel(gf); gf.CalculateGroupsAndSeries(); RepoFactory.GroupFilter.Save(gf); return(new Filter(HttpContext, gf)); }