public async Task <IActionResult> Post(MedicoConsulta model)
        {
            try
            {
                _medCons.add(model);

                if (await _medCons.SaveChangesAsync())
                {
                    return(Created($"/api/medicoConsulta/{model.Id}", model));
                }
            }
            catch (System.Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados"));
            }

            return(BadRequest());
        }
Esempio n. 2
0
        public async Task <IActionResult> Post(Funcionario model)
        {
            try
            {
                _fun.add(model);
                _fun.add(model.Pessoa.Usuario);

                if (await _fun.SaveChangesAsync())
                {
                    return(Created($"/api/funcionario/{model.Id}", model));
                }
            }
            catch (System.Exception)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Falha no Banco de dados"));
            }

            return(BadRequest());
        }