Пример #1
0
        public async Task <IActionResult> PutThreat(int id,
                                                    [FromBody] ReliabilityThreatPutRp model)
        {
            var response = await this._ReliabilityRiskComponent.UpdateThreat(id,
                                                                             model);

            return(this.Ok(response));
        }
Пример #2
0
        public async Task <ReliabilityThreatGetRp> UpdateThreat(int id, ReliabilityThreatPutRp model)
        {
            var modifiedBy = this._identityGateway.GetIdentity();
            var modifiedOn = this._datetimeGateway.GetCurrentDateTime();

            this._dbContext.ChangeTracker.AutoDetectChangesEnabled = true;

            var item = this._dbContext.ReliabilityThreats.Where(c => c.Id == id).SingleOrDefault();

            if (item != null)
            {
                item.Update(modifiedOn, modifiedBy, model.Name, model.Avatar, model.Reference,
                            model.Description, model.Tags, model.ETTD, model.ETTE, model.ETTF,
                            model.UserImpact, model.ETTFail);
                this._dbContext.ReliabilityThreats.Update(item);
                await this._dbContext.SaveChangesAsync();
            }
            return(this._mapper.Map <ReliabilityThreatGetRp>(item));
        }
Пример #3
0
        public static IEnumerable <ReliabilityThreatPutRp> Build(SheetRowAdapter adapter)
        {
            var items = new List <ReliabilityThreatPutRp>();

            for (int row = 2; row <= adapter.getRows(); row++)
            {
                var result = new ReliabilityThreatPutRp();
                result.Name        = adapter.get <string>(row, 1);
                result.Avatar      = adapter.get <string>(row, 2);
                result.Reference   = adapter.get <string>(row, 3);
                result.Description = adapter.get <string>(row, 4);
                result.Tags        = adapter.get <string>(row, 5);
                result.ETTD        = adapter.get <int>(row, 6);
                result.ETTE        = adapter.get <int>(row, 7);
                result.ETTF        = adapter.get <int>(row, 8);
                result.UserImpact  = adapter.get <decimal>(row, 9);
                result.ETTFail     = adapter.get <int>(row, 10);
                items.Add(result);
            }
            return(items);
        }