public static dynamic GameLoad(GameCreateRequest request, string appId) { dynamic response; var stateJson = DataAccess.StateGet(appId, request.GameId); if (!string.IsNullOrEmpty(stateJson)) { response = new GameLoadResponse { State = JsonConvert.DeserializeObject(stateJson) }; return(response); } //TBD - check how deleteIfEmpty works with createifnot exists if (stateJson == string.Empty) { DataAccess.StateDelete(appId, request.GameId); //_logger.LogInformation($"Deleted empty state, app id {appId}, gameId {request.GameId}"); } if (request.CreateIfNotExists) { response = new OkResponse(); //_logger.LogInformation($"{Request.GetUri()} - {JsonConvert.SerializeObject(response)}"); return(response); } response = new ErrorResponse { Message = "GameId not Found." }; //_logger.LogError($"{Request.GetUri()} - {JsonConvert.SerializeObject(response)}"); return(response); }
public static dynamic GameLoad(GameCreateRequest request, string appId) { dynamic response; string stateJson = string.Empty; stateJson = WebApiApplication.DataAccess.StateGet(appId, request.GameId); if (!string.IsNullOrEmpty(stateJson)) { response = new GameLoadResponse { State = JsonConvert.DeserializeObject(stateJson) }; return response; } //TBD - check how deleteIfEmpty works with createifnot exists if (stateJson == string.Empty) { WebApiApplication.DataAccess.StateDelete(appId, request.GameId); if (log.IsDebugEnabled) { log.DebugFormat("Deleted empty state, app id {0}, gameId {1}", appId, request.GameId); } } if (request.CreateIfNotExists) { response = new OkResponse(); return response; } response = new ErrorResponse { Message = "GameId not Found." }; return response; }
public static dynamic GameLoad(GameCreateRequest request, string appId) { dynamic response; string stateJson = string.Empty; stateJson = WebApiApplication.DataAccess.StateGet(appId, request.GameId); if (!string.IsNullOrEmpty(stateJson)) { response = new GameLoadResponse { State = JsonConvert.DeserializeObject(stateJson) }; return(response); } //TBD - check how deleteIfEmpty works with createifnot exists if (stateJson == string.Empty) { WebApiApplication.DataAccess.StateDelete(appId, request.GameId); if (log.IsDebugEnabled) { log.DebugFormat("Deleted empty state, app id {0}, gameId {1}", appId, request.GameId); } } if (request.CreateIfNotExists) { response = new OkResponse(); return(response); } response = new ErrorResponse { Message = "GameId not Found." }; return(response); }