コード例 #1
0
ファイル: Edit.cshtml.cs プロジェクト: qqdqq/tpd
        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"));
        }
コード例 #2
0
ファイル: Create.cshtml.cs プロジェクト: qqdqq/tpd
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

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

            return(RedirectToPage("./Index"));
        }
コード例 #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"));
        }
コード例 #4
0
ファイル: Delete.cshtml.cs プロジェクト: qqdqq/tpd
        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"));
        }
コード例 #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"));
        }
コード例 #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"));
        }
コード例 #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"));
        }