Beispiel #1
0
 public HttpResponseMessage<GameDto> Put(string id, GameDto game)
 {
     if (!CheckIdAndExists(id)) throw new HttpResponseException(HttpStatusCode.NotFound);
     var updated = _gamesService.Update(id, game.ToGame());
     return new HttpResponseMessage<GameDto>(updated.ToDto(), HttpStatusCode.OK);
 }
Beispiel #2
0
 public HttpResponseMessage<GameDto> Post(GameDto game)
 {
     var created = _gamesService.Create(game.ToGame());
     if (created == null) throw new HttpResponseException(HttpStatusCode.BadRequest);
     return new HttpResponseMessage<GameDto>(created.ToDto(), HttpStatusCode.Created);
 }