public Exercicio Update(UpdateExercicioCommand command) { var exercicio = _repository.GetId(command.ExercicioId); exercicio.UpdateExercicio(command.DsExercicio); _repository.Update(exercicio); if (Commit()) { return(exercicio); } return(null); }
public Task <HttpResponseMessage> Put(int id, [FromBody] dynamic body) { var response = new HttpResponseMessage(); try { var command = new UpdateExercicioCommand( exercicioId: (int)body.id, dsExercicio: (string)body.exercicio ); var exercicio = _service.Update(command); response = Request.CreateResponse(HttpStatusCode.OK, "Atualizado com sucesso!"); } catch { response = Request.CreateResponse(HttpStatusCode.BadRequest, "Não foi Atualizado o usuário!"); } var tsc = new TaskCompletionSource <HttpResponseMessage>(); tsc.SetResult(response); return(tsc.Task); }