Пример #1
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("Adding face to a person");

            try
            {
                var personIdQuery = req.Query["personId"];
                var personId      = Guid.Parse(personIdQuery);
                var userEmail     = req.Query["email"];

                var person = await _faceService.AddFaceToPerson(personId, userEmail, req.Body);

                await _faceService.TrainPersonGroup(ConfigurationSettings.PersonGroupId);

                return((ActionResult) new OkObjectResult(person));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                log.LogError($"error adding face to person: {e.Message}");
                return((ActionResult) new OkObjectResult(null));
            }
        }