Example #1
0
        public string Delete(int Id)
        {
            try
            {
                if (!PossuiVinculo(Id))
                {
                    Models.Entidade.Doctor pDoctor  = new Models.Entidade.Doctor();
                    Models.Dados.Doctor    DBDoctor = new Models.Dados.Doctor();

                    pDoctor.Id = Id;

                    DBDoctor.Excluir(pDoctor);

                    return("Excluido com Sucesso!");
                }
                else
                {
                    return("Não foi possivel excluir doctor está vinculado a um paciente!");
                }
            }
            catch (Exception)
            {
                return("Falha ao Excluir!");
            }
        }
Example #2
0
        public HttpResponseMessage Get()
        {
            Models.Entidade.Doctor pDoctor  = new Models.Entidade.Doctor();
            Models.Dados.Doctor    DBDoctor = new Models.Dados.Doctor();

            var Lista = DBDoctor.Listar(pDoctor);

            return(Request.CreateResponse(HttpStatusCode.OK, Lista));
        }
Example #3
0
        public string Put(Models.Entidade.Doctor pDoctor)
        {
            try
            {
                Models.Dados.Doctor DBDoctor = new Models.Dados.Doctor();

                DBDoctor.Atualizar(pDoctor);

                return("Atualizado com Sucesso!");
            }
            catch (Exception)
            {
                return("Falha ao Atualizar!");
            }
        }
Example #4
0
        private bool VerificaCrm(Doctor pDoctor)
        {
            bool Crm = false;

            Models.Dados.Doctor DBDoctor = new Models.Dados.Doctor();

            var CrmExistente = DBDoctor.VerificaCrm(pDoctor);

            if (CrmExistente.Count() > 0)
            {
                Crm = true;
            }

            return(Crm);
        }
Example #5
0
        private bool PossuiVinculo(int pId)
        {
            bool PossuiVinculo = false;

            Models.Dados.Doctor DBDoctor = new Models.Dados.Doctor();

            var Existe = DBDoctor.VerificaVinculo(pId);

            if (Existe.Count() > 0)
            {
                PossuiVinculo = true;
            }

            return(PossuiVinculo);
        }
Example #6
0
        public string Post(Models.Entidade.Doctor pDoctor)
        {
            try
            {
                if (!VerificaCrm(pDoctor))
                {
                    Models.Dados.Doctor DBDoctor = new Models.Dados.Doctor();

                    DBDoctor.Incluir(pDoctor);

                    return("Inserido com Sucesso!");
                }
                else
                {
                    return("CRM já existente!");
                }
            }
            catch (Exception)
            {
                return("Falha ao Inserir!");
            }
        }