Esempio n. 1
0
        public static ViewModels.Role CopyToViewModel(this DomainModels.UserRole domainModel, ViewModels.Role viewModel = null)
        {
            if (viewModel == null)
            {
                viewModel = new ViewModels.Role();
            }

            viewModel.ID          = domainModel.ID;
            viewModel.Name        = domainModel.Name;
            viewModel.Description = domainModel.Description;

            return(viewModel);
        }
Esempio n. 2
0
        public static DomainModels.UserRole CopyToDomainModel(this ViewModels.Role viewModel, DomainModels.UserRole domainModel = null)
        {
            if (domainModel == null)
            {
                domainModel = new DomainModels.UserRole();
            }

            domainModel.ID          = viewModel.ID;
            domainModel.Name        = viewModel.Name;
            domainModel.Description = viewModel.Description;
            domainModel.State       = viewModel._state.Equals("added", StringComparison.CurrentCultureIgnoreCase) ? DomainModels.EntityState.Add :
                                      viewModel._state.Equals("removed", StringComparison.CurrentCultureIgnoreCase) ? DomainModels.EntityState.Delete : DomainModels.EntityState.Modify;

            return(domainModel);
        }