protected void eBooksControl_OnEditItem(object sender, GenericEventArgs <Guid> e) { var entity = DataContext.LP_EBooks.FirstOrDefault(n => n.ID == e.Value); if (entity == null) { return; } var converter = new EBookEntityModelConverter(DataContext); var model = converter.Convert(entity); eBookControl.Model = model; mpeAddEdit.Show(); }
private void FillDataGrid() { var entities = (from n in DataContext.LP_EBooks where n.DateDeleted == null orderby n.DateCreated descending select n).ToList(); var converter = new EBookEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new EBooksModel(); model.List = models; eBooksControl.Model = model; }
private void FillEBooks() { var currentLanguage = LanguageUtil.GetLanguage(); var query = from n in DataContext.LP_EBooks where n.DateDeleted == null && (n.Language == currentLanguage || n.Language == null || n.Language == "") orderby n.OrderIndex, n.DateCreated descending select n; var entities = query.ToList(); var converter = new EBookEntityModelConverter(DataContext); var models = (from n in entities let m = converter.Convert(n) select m).ToList(); var model = new EBooksModel(); model.List = models; eBooksControl.Model = model; }