public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CriminalCodeExists(CriminalCode.Id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(Redirect(url: "https://localhost:5001/CrimeLocations/Create"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            SubmitCompleted = true;

            return(Page());
        }
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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