// To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(DeviceComposition).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DeviceCompositionExists(DeviceComposition.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(NirInnovationRate).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NirInnovationRateExists(NirInnovationRate.NirScaleID, NirInnovationRate.NirInnovationPropertyID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var okrInnovationRate = await _context.OkrInnovationRates
                                    .Where(n => n.OkrInnovationPropertyID == Okr.OkrInnovationPropertyID)
                                    .Where(n => n.DeviceCompositionID == Okr.DeviceCompositionID)
                                    .FirstOrDefaultAsync();

            var deviceComplexityRate = await _context.DeviceComplexityRates
                                       .Where(n => n.DeviceCompositionID == Okr.DeviceCompositionID)
                                       .Where(n => n.DeviceCountRangeID == Okr.DeviceCountRangeID)
                                       .FirstOrDefaultAsync();

            Okr.DeviceComplexityRateID = deviceComplexityRate.ID;
            Okr.OkrInnovationRateID    = okrInnovationRate.ID;

            _context.Attach(Okr).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OkrExists(Okr.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }