Esempio n. 1
0
        public static async Task <IActionResult> InsertUserTrend([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "trends/user")] HttpRequest req, ILogger log)
        {
            log.LogInformation("Inserting User Trend");
            string  response = new StreamReader(req.Body).ReadToEnd();//int userId, string trendName
            var     resp     = JsonConvert.DeserializeAnonymousType(response, new { UserId = 0, TrendName = "" });
            Options opts     = GetOptions();
            Trends  trends   = new Trends(GetOptions());

            try
            {
                await trends.InsertUserTrend(resp.UserId, resp.TrendName);

                return(new OkResult());
            }
            catch
            {
                return(new BadRequestResult());
            }
        }