public PartialViewResult Rules(int categoryId) { var rulesforevent = repository.GetRulesForCategory(categoryId); var available = repository.AvailableRules.ToList(); available.RemoveAll(x => rulesforevent.Exists(y => y.Rule.RuleId == x.RuleId)); var model = new RulesViewModel { AvailableRules = available, RulesForEvent = rulesforevent, CategoryId = categoryId }; return PartialView("_Rules", model); }
public PartialViewResult Rules(int eventId) { var rulesforevent = repository.GetRulesForEvent(eventId) ?? new List<RuleParameter>(); var available = repository.AvailableRules.ToList(); available.RemoveAll(x => rulesforevent.Exists(y => y.Rule.RuleId == x.RuleId)); var model = new RulesViewModel { AvailableRules = available, RulesForEvent = rulesforevent, EventId = eventId }; return PartialView("_Rules", model); }