public LifeLogService( ISlackManualDiaryService slackManualDiaryService, IBlogAnalytcsService blogPvStringLoader, IIFTTTService iftttService, IWeightMeasurementService weightMeasurementService, IGitHubService gitHubContributionsReader, SleepDataService sleepDataService ) { this.slackManualDiaryService = slackManualDiaryService; this.blogPvStringLoader = blogPvStringLoader; this.iftttService = iftttService; this.weightMeasurementService = weightMeasurementService; this.gitHubContributionsReader = gitHubContributionsReader; this.sleepDataService = sleepDataService; }
public static async Task <HttpResponseMessage> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = "bodymesurement")] HttpRequestMessage req, ILogger logger, [Inject] IWeightMeasurementService weightMeasurementService ) { var json = await req.Content.ReadAsStringAsync(); logger.LogInformation(json); var entity = WeightMesurementEntity.Parse(json); entity.InsertedTime = DateTime.UtcNow; logger.LogInformation($"weight={entity.Weight}, leanMass={entity.LeanMass}, fatMass={entity.FatMass}, fatPercent={entity.FatPercent}, mesuredAt={entity.MesuredAt}"); await weightMeasurementService.AddData(entity); return(req.CreateResponse(HttpStatusCode.OK, JsonConvert.SerializeObject(entity))); }