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

            _db.Attach(Blog).State = EntityState.Modified;

            try
            {
                _db.Blogs.Update(Blog);
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw new Exception($"Blog {Blog.Id} not found");
            }

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