public bool Delete(ProfessorDTO professor) { try { return ProfessorRepository.Delete(Mapper.Map<ProfessorDTO, Professor>(professor)); } catch (Exception) { throw new ServiceFaultException("Não foi possível excluir o professor"); } }
public ProfessorDTO Find(int id) { ProfessorDTO professor = new ProfessorDTO(); try { professor = Mapper.Map<Professor, ProfessorDTO>(ProfessorRepository.Find(id)); } catch (Exception) { throw new ServiceFaultException("Não foi possível recuperar o professor"); } return professor; }
public bool Add(ProfessorDTO professor) { bool retorno = false; try { ProfessorRepository.Add(Mapper.Map<ProfessorDTO, Professor>(professor)); retorno = true; } catch (Exception) { throw new ServiceFaultException("Não foi possível incluir o professor"); } return retorno; }