Beispiel #1
0
        public async Task <IActionResult> ApplyIndicatorIndexValue([FromBody] IndicatorIndexValueModel req)
        {
            await this._indicatorIndexCityValueService.ApplyIndicatorIndexValue(req);

            var relatedIndicatorIndex = await this._indicatorIndexService.Get(req.IndicatorIndexId);

            await this._indicatorValueService.RecalculateValue(relatedIndicatorIndex.IndicatorId, req.CityId, req.Year);

            return(Json(true));
        }
        public async Task ApplyIndicatorIndexValue(IndicatorIndexValueModel rec)
        {
            var createdvalueRec = new IndicatorIndexCityValue
            {
                CityId           = rec.CityId,
                Value            = rec.Value,
                CalcDate         = DateTime.Now,
                IndicatorIndexId = rec.IndicatorIndexId,
                PeriodStart      = new DateTime(rec.Year, 1, 1),
                PeriodEnd        = new DateTime(rec.Year, 12, 31)
            };

            await this.Add(createdvalueRec);
        }