public void AddQuestion(QuestionRecomendation questionRecomendations) { scoreCalculated = false; try { int categoryId = context.Questions.Find(questionRecomendations.questionId).CategoryId; CategoryRecomendation parentCategory = null; foreach (CategoryRecomendation category in categories) { if (category.CategoryId == categoryId) { parentCategory = category; break; } } if (parentCategory == null) { parentCategory = new CategoryRecomendation(categoryId); categories.Add(parentCategory); } parentCategory.QuestionRecomendations.Add(questionRecomendations); OverallVendors = context.Vendors.Join(context.OverallCategoryVendorEntries, v => v.Id, ocve => ocve.VendorId, (v, ocve) => v ).ToList(); } catch { throw new ArgumentException("Unknown question category"); } }
public void AddQuestion(QuestionRecomendation questionRecomendations) { scoreCalculated = false; try { int categoryId = context.Questions.Find(questionRecomendations.questionId).CategoryId; CategoryRecomendation parentCategory = null; foreach (CategoryRecomendation category in categories) { if (category.CategoryId == categoryId) { parentCategory = category; break; } } if (parentCategory == null) { parentCategory = new CategoryRecomendation(categoryId); categories.Add(parentCategory); } parentCategory.QuestionRecomendations.Add(questionRecomendations); OverallVendors = context.Vendors.Join(context.OverallCategoryVendorEntries, v => v.Id, ocve => ocve.VendorId, (v, ocve) => v ).ToList(); } catch { throw new ArgumentException("Unknown question category"); } }