public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { var requestBody = await req.ReadAsStringAsync(); log.LogInformation(requestBody); var message = new Message(requestBody); log.LogInformation(message.Memory); var date = DateTime.Parse(message.DateAnswer); var littleWinEntity = new LittleWinEntity(message.DetailAnswer, date); var result = await _tableContext.InsertOrMergeEntityAsync(littleWinEntity); var jsonResponsePositive = @"{ ""actions"":[{""say"": ""You achievement was saved successfully!""}]}"; var jsonResponseNegative = @"{ ""actions"": [ {""say"": ""There was a problem saving your achievement""}]}"; return(result != null ? new ContentResult { Content = jsonResponsePositive, ContentType = "application/json", StatusCode = 200 } : new ContentResult { Content = jsonResponseNegative, ContentType = "application/json", StatusCode = 418 }); }
private async Task <GeneralStatusEnum> SaveAudioDetails( string fileName, string id, ProcessStatusEnum status, string audioUrl = null) { var uploadEntity = new AudioEntity("Uploads", id, fileName, status, audioUrl); return(await _tableDbContext.InsertOrMergeEntityAsync(uploadEntity)); }