public async Task <IActionResult> Put(int wisheId, Wishe model) { try { var wishe = await _repo.GetWisheAsyncByIdAsync(wisheId, false, false); if (wishe == null) { return(NotFound()); } _repo.Update(model); if (await _repo.SaveChangesAsync()) { return(Created($"/api/wishe/{model.Id}", model)); } } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco Dados Falhou " + ex.Message)); } return(BadRequest()); }
public async Task <IActionResult> Post(Wishe model) { try { _repo.Add(model); if (await _repo.SaveChangesAsync()) { return(Created($"/api/wishe/{model.Id}", model)); } } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco Dados Falhou")); } return(BadRequest()); }