コード例 #1
0
ファイル: Edit.cshtml.cs プロジェクト: Aikangel/CarRentalDB
        // 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(Car_Brands).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Car_BrandsExists(Car_Brands.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.Cars.Add(Cars);
            await _context.SaveChangesAsync();

            return(RedirectToPage("./Index"));
        }
コード例 #3
0
ファイル: Delete.cshtml.cs プロジェクト: Aikangel/CarRentalDB
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

            return(RedirectToPage("./Index"));
        }
コード例 #4
0
ファイル: Delete.cshtml.cs プロジェクト: Aikangel/CarRentalDB
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

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

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

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

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

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

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