/// <summary> /// Atribui dados da responsavel Model para a responsavel Entity /// </summary> /// <param name="responsavel">Objeto do modelo</param> /// <param name="esp">Entity mapeada da base de dados</param> private void Atribuir(ResponsavelModel responsavel, tb_responsavel responsavelE) { responsavelE.id_Responsavel = responsavel.id_Responsavel; responsavelE.nome = responsavel.nome; responsavelE.sobrenome = responsavel.sobrenome; responsavelE.email = responsavel.email; }
/// <summary> /// Altera dados na base de dados /// </summary> /// <param name="responsavel"></param> public void Editar(ResponsavelModel responsavel) { tb_responsavel responsavelE = new tb_responsavel(); Atribuir(responsavel, responsavelE); unitOfWork.RepositorioResponsavel.Editar(responsavelE); unitOfWork.Commit(shared); }
/// <summary> /// Insere um novo na base de dados /// </summary> /// <param name="responsavel">Dados do modelo</param> /// <returns>Chave identificante na base</returns> public int Inserir(ResponsavelModel responsavel) { tb_responsavel responsavelE = new tb_responsavel(); Atribuir(responsavel, responsavelE); unitOfWork.RepositorioResponsavel.Inserir(responsavelE); unitOfWork.Commit(shared); return(responsavelE.id_Responsavel); }