Пример #1
0
        protected void contentsControl_OnEditItem(object sender, GenericEventArgs <Guid> e)
        {
            var entity = DataContext.LP_Contents.FirstOrDefault(n => n.ID == e.Value);

            if (entity == null)
            {
                return;
            }

            var converter = new ContentEntityModelConverter(DataContext);
            var model     = converter.Convert(entity);

            contentControl.Model = model;
            mpeAddEdit.Show();
        }
Пример #2
0
        private void FillDataGrid()
        {
            var entities = (from n in DataContext.LP_Contents
                            where n.DateDeleted == null &&
                            n.Type == "Content"
                            orderby n.DateCreated
                            select n).ToList();

            var converter = new ContentEntityModelConverter(DataContext);

            var models = (from n in entities
                          let m = converter.Convert(n)
                                  select m).ToList();

            var model = new ContentsModel();

            model.List = models;

            contentsControl.Model = model;
        }