コード例 #1
0
        public static PersonFullDisplayViewModel ToViewModel(this PersonFullDisplayModel src, IEnumerable <CategoryModel> categories = null)
        {
            var r = new PersonFullDisplayViewModel
            {
                Id              = src.Id,
                FirstName       = src.FirstName,
                LastName        = src.LastName,
                CategoryDisplay = src.Category,
            };

            if (categories != null)
            {
                var c = categories.ToViewModel(src.CategoryKey);
                r.Categories = new ObservableCollection <CategoryViewModel>(c);
            }
            return(r);
        }
コード例 #2
0
        public static PersonFullDisplayModel ToModel(this PersonFullDisplayViewModel src)
        {
            var result = new PersonFullDisplayModel
            {
                Id          = src.Id,
                FirstName   = src.FirstName,
                LastName    = src.LastName,
                Category    = src.CategoryDisplay,
                CategoryIds = (from c in src.Categories
                               where c.IsSelected
                               select c.Id).ToList(),
                ReceptionIds = (from r in src.Receptions
                                where r.IsSelected
                                select r.Id).ToList()
            };

            return(result);
        }