コード例 #1
0
        public async Task <IActionResult> DeleteAsync([FromBody] Dominio.Entidades.Profissional profissional, [FromRoute] string token)
        {
            try
            {
                await _pfService.RemoveAsync(profissional, token);

                //await _tfService.RemoveAsync(profissional.Telefone, token);
                //await _edService.RemoveAsync(profissional.Endereco, token);

                return(Ok("Profissional removido com sucesso."));
            }
            catch (Exception e)
            {
                return(StatusCode(500, "Não foi possível completar a operação."));
            }
        }
コード例 #2
0
        public async Task <IActionResult> UpdateAsync([FromRoute] string token, [FromBody] Dominio.Entidades.Profissional profissional)
        {
            try
            {
                var pf = await _pfService.UpdateAsync(profissional, token);

                await _edService.UpdateAsync(pf.Endereco, token);

                await _tfService.UpdateAsync(pf.Telefone, token);

                return(Ok("Profissional atualizado com sucesso."));
            }
            catch (Exception e)
            {
                return(StatusCode(500, "Não foi possível completar a operação."));
            }
        }
コード例 #3
0
        public async Task <IActionResult> SaveAsync([FromRoute] string token, [FromBody] Dominio.Entidades.Profissional profissional)
        {
            try
            {
                var pf = await _pfService.SaveAsync(profissional, token);

                if (pf.Telefone != null)
                {
                    pf.Telefone = await _tfService.SaveAsync(pf.Telefone, token);
                }

                if (pf.Endereco != null)
                {
                    pf.Endereco = await _edService.SaveAsync(pf.Endereco, token);
                }

                return(Ok(pf));
            }
            catch (Exception e)
            {
                return(StatusCode(500, "Não foi possível completar a operação."));
            }
        }