public async Task <ActionResult> Delete(Guid id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var result = await _service.Delete(id); if (result == false) { return(BadRequest("Time não encontrado")); } else { return(Ok("Excluído com sucesso")); } } catch (ArgumentException e) { return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message)); } }
public async Task <ActionResult> Delete(int id) { try { await _service.Delete(id); return(Ok()); } catch (Exception e) { Console.WriteLine(e); } return(BadRequest()); }
public async Task <bool> Delete(Guid id) { try { var result = await _timeService.Delete(id); await _timeService.Commit(); return(result); } catch (Exception) { _timeService.Dispose(); throw; } }