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.")); } }
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.")); } }
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.")); } }