public string Post(Models.Entidade.Patient pPatient) { try { if (!VerificaCpfExiste(pPatient)) { if (!CpfIsInvalido(pPatient.CPF)) { Models.Dados.Patient DBPatient = new Models.Dados.Patient(); DBPatient.Incluir(pPatient); return("Inserido com Sucesso!"); } else { return("CPF inválido!"); } } else { return("CPF já existente!"); } } catch (Exception) { return("Falha ao Inserir!"); } }
public HttpResponseMessage Get() { Models.Entidade.Patient pPatient = new Models.Entidade.Patient(); Models.Dados.Patient DBPatient = new Models.Dados.Patient(); var teste = DBPatient.Listar(pPatient); return(Request.CreateResponse(HttpStatusCode.OK, teste)); }
private bool VerificaCpfExiste(Models.Entidade.Patient pPatient) { bool Existe = false; Models.Dados.Patient DBPatient = new Models.Dados.Patient(); var CpfExistente = DBPatient.VerificaCpfExiste(pPatient); if (CpfExistente.Count() > 0) { Existe = true; } return(Existe); }
public string Delete(int Id) { try { Models.Entidade.Patient pPatient = new Models.Entidade.Patient(); Models.Dados.Patient DBPatient = new Models.Dados.Patient(); pPatient.Id = Id; DBPatient.Excluir(pPatient); return("Excluido com Sucesso!"); } catch (Exception) { return("Falha ao Excluir!"); } }