public static ViewModels.Press CopyToViewModel(this DomainModels.Press domainModel, ViewModels.Press viewModel = null) { if (viewModel == null) { viewModel = new ViewModels.Press(); } viewModel.ID = domainModel.ID; viewModel.Name = domainModel.Name; viewModel.Address = domainModel.Address; viewModel.Contact = domainModel.Contact; return(viewModel); }
public static DomainModels.Press CopyToDomainModel(this ViewModels.Press viewModel, DomainModels.Press domainModel = null) { if (domainModel == null) { domainModel = new DomainModels.Press(); } domainModel.ID = viewModel.ID; domainModel.Name = viewModel.Name; domainModel.Address = viewModel.Address; domainModel.Contact = viewModel.Contact; 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); }