public HttpResponseMessage DeleteGame(int id) { bool res = false; GameProfileService gPSvc = new GameProfileService(); try { res = gPSvc.DeleteGame(id); return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (System.Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage SelectGameById(int id) { GameProfile res = new GameProfile(); GameProfileService gPSvc = new GameProfileService(); try { res = gPSvc.SelectById(id); return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (System.Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage SelectAllGames() { List <GameProfile> gamesList = new List <GameProfile>(); GameProfileService gPSvc = new GameProfileService(); try { gamesList = gPSvc.SelectAll(); return(Request.CreateResponse(HttpStatusCode.OK, gamesList)); } catch (System.Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage SelectAllAttributes() { GameAttributes attributes = new GameAttributes(); GameProfileService gPSvc = new GameProfileService(); try { attributes = gPSvc.SelectAllAttributes(); return(Request.CreateResponse(HttpStatusCode.OK, attributes)); } catch (System.Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage UpdateGame(GameProfileRequest model) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, "Field is invalid")); } bool res = false; GameProfileService gPSvc = new GameProfileService(); try { res = gPSvc.UpdateGame(model); return(Request.CreateResponse(HttpStatusCode.OK, res)); } catch (System.Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public GameProfileController(UserService userService, GameProfileService gameProfileService) : base(userService) { _gameProfileService = gameProfileService; }