示例#1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                //if (!SpecSelResultExists(SpecSelResult.ID))
                if (!_context.SpecSelResult.Any(e => e.ID == SpecSelResult.ID))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
示例#2
0
        /// <summary>
        /// The OnPostAsync method is run when the page posts form data.
        /// If there are any model errors, the form is redisplayed, along with any form data posted.
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.SpecSelResult.Add(SpecSelResult);
            await _context.SaveChangesAsync();

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

            SpecSelResult = await _context.SpecSelResult.FindAsync(id);

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

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