Ejemplo n.º 1
0
        public static ViewModels.Author CopyToViewModel(this DomainModels.Author domainModel, ViewModels.Author viewModel = null)
        {
            if (viewModel == null)
            {
                viewModel = new ViewModels.Author();
            }

            viewModel.ID           = domainModel.ID;
            viewModel.Name         = domainModel.Name;
            viewModel.Introduction = domainModel.Introduction;

            return(viewModel);
        }
Ejemplo n.º 2
0
        public static DomainModels.Author CopyToDomainModel(this ViewModels.Author viewModel, DomainModels.Author domainModel = null)
        {
            if (domainModel == null)
            {
                domainModel = new DomainModels.Author();
            }

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

            return(domainModel);
        }