コード例 #1
0
        // 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"));
        }
コード例 #2
0
        // 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"));
        }
コード例 #3
0
        // 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.Okrs.Add(Okr);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
コード例 #4
0
        // 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.DeviceCountRanges.Add(DeviceCountRange);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
コード例 #5
0
        // 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.OkrInnovationProperties.Add(OkrInnovationProperty);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
コード例 #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            DeviceCountRange = await _context.DeviceCountRanges.FindAsync(id);

            if (DeviceCountRange != null)
            {
                _context.DeviceCountRanges.Remove(DeviceCountRange);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #7
0
        public async Task <IActionResult> OnPostAsync(int?nirID, int?nirInnovationPropertyID)
        {
            if (nirID == null || nirInnovationPropertyID == null)
            {
                return(NotFound());
            }

            NirInnovationRate = await _context.NirInnovationRates.FindAsync(nirID, nirInnovationPropertyID);

            if (NirInnovationRate != null)
            {
                _context.NirInnovationRates.Remove(NirInnovationRate);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            OkrInnovationProperty = await _context.OkrInnovationProperties.FindAsync(id);

            if (OkrInnovationProperty != null)
            {
                _context.OkrInnovationProperties.Remove(OkrInnovationProperty);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #9
0
        public async Task <IActionResult> OnPostAsync(int?okrInnovationPropertyID, int?deviceCompositionID)
        {
            if (okrInnovationPropertyID == null || deviceCompositionID == null)
            {
                return(NotFound());
            }

            OkrInnovationRate = await _context.OkrInnovationRates
                                .FindAsync(okrInnovationPropertyID, deviceCompositionID);

            if (OkrInnovationRate != null)
            {
                _context.OkrInnovationRates.Remove(OkrInnovationRate);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #10
0
        // 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"));
        }