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

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

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

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

            _context.Departments.Add(Department);
            await _context.SaveChangesAsync();

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

            Vendor = await _context.Vendors.FindAsync(id);

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

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

            Department = await _context.Departments.FindAsync(id);

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

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

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

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

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

            Location = await _context.Locaitons.FindAsync(id);

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

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

            var isAuthorized = await AuthorizationService.AuthorizeAsync(
                User, Attraction,
                AttractionOperations.Create);

            if (!isAuthorized.Succeeded)
            {
                return(new ChallengeResult());
            }

            _context.Attractions.Add(Attraction);
            await _context.SaveChangesAsync();

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