Пример #1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            dbContext.Attach(Note).State = EntityState.Modified;

            try
            {
                await dbContext.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                throw new Exception($"Note: '{Note.Id}' could not be edited", ex);
            }

            return(RedirectToPage("/Notes"));
        }