Example #1
0
        public async Task <IActionResult> OnPostDeleteAsync(int id)
        {
            var customer = await _db.ArtWorks.FindAsync(id);

            if (customer != null)
            {
                _db.ArtWorks.Remove(customer);
                await _db.SaveChangesAsync();
            }

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

            _db.ArtWorks.Add(ArtWork);
            await _db.SaveChangesAsync();

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

            _db.Attach(ArtWork).State = EntityState.Modified;
            await _db.SaveChangesAsync();

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