private void FillDataGrid() { var entities = (from n in DataContext.LP_Surveys where n.DateDeleted == null orderby n.OrderIndex, n.DateCreated select n).ToList(); var converter = new SurveyEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new SurveysModel(); model.List = models; surveysControl.Model = model; }
private void FillSurveys() { var parentID = DataConverter.ToNullableGuid(Request["ID"]); var currentLanguage = LanguageUtil.GetLanguage(); var query = from n in DataContext.LP_Surveys where n.DateDeleted == null && (n.Language == currentLanguage || n.Language == null || n.Language == "") select n; if (parentID == null) { query = from n in query where n.ParentID == null select n; } else { query = from n in query where n.ParentID == parentID select n; } query = from n in query orderby n.OrderIndex, n.DateCreated select n; var entities = query.ToList(); var converter = new SurveyEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new SurveysModel(); model.List = models; surveysControl.Model = model; }