コード例 #1
0
        public async Task <IEnumerable <SourceItemBaseRp> > CreateLatencyItem(SourceItemLatencyPostRp model)
        {
            var createdBy = this._identityGateway.GetIdentity();
            var on        = this._datetimeGateway.GetCurrentDateTime();
            var source    = await this._dbContext.Sources.SingleAsync(c => c.Id == model.SourceId);

            var range = SourceEntity.Factory.CreateItemsFromRangeByMeasure(source, model.Start,
                                                                           model.End, model.Measure, on, createdBy,
                                                                           SourceGroupEnum.Latency);

            foreach (var item in range)
            {
                this._dbContext.SourcesItems.Add(item);
            }

            await this._dbContext.SaveChangesAsync();

            return(this._mapper.Map <IEnumerable <SourceItemBaseRp> >(range));
        }
コード例 #2
0
        public async Task <IActionResult> PostLatencyItem([FromBody] SourceItemLatencyPostRp model)
        {
            var result = await this._sourceItemComponent.CreateLatencyItem(model);

            return(this.Ok(result));
        }