public static async Task <IActionResult> GetAllGamemodes( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "gamemodes/all")] HttpRequest req, ILogger log) { List <Gamemode> gamemodes = await GamemodeRepository.GetGamemodesAsync(false); return(new OkObjectResult(gamemodes)); }
public static async Task <IActionResult> AddGamemode( [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "gamemodes")] HttpRequest req, ILogger log) { string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); Gamemode gamemode = JsonConvert.DeserializeObject <Gamemode>(requestBody); Gamemode added = await GamemodeRepository.AddGamemodeAsync(gamemode); return(new OkObjectResult(added)); }