public ClienteViewModel GetViewModel(ClienteEntity entity) { var viewModel = new ClienteViewModel(); viewModel.Id = entity.Id; viewModel.NomeFantasia = entity.NomeFantasia; viewModel.RazaoSocial = entity.RazaoSocial; viewModel.Cnpj = entity.Cnpj; viewModel.Email = entity.Email; viewModel.Telefone1 = entity.Telefone1; viewModel.Telefone2 = entity.Telefone2; viewModel.NomeResponsavel = entity.NomeResponsavel; viewModel.Loja = entity.Loja; viewModel.CodEndereco = entity.CodEndereco; return viewModel; }
public ClienteEntity SetEntity(ClienteViewModel viewModel) { Check.Arg.IsNotNull(() => viewModel); Check.Arg.IsNotNull(() => viewModel.Endereco); var entity = new ClienteEntity(); entity.Id = viewModel.Id; entity.NomeFantasia = viewModel.NomeFantasia; entity.RazaoSocial = viewModel.RazaoSocial; entity.Cnpj = viewModel.Cnpj; entity.Email = viewModel.Email; entity.Telefone1 = viewModel.Telefone1; entity.Telefone2 = viewModel.Telefone2; entity.NomeResponsavel = viewModel.NomeResponsavel; entity.Loja = viewModel.Loja; entity.CodEndereco = viewModel.CodEndereco; return entity; }