Exemple #1
0
        public async Task <IActionResult> OnpostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }



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

            try
            {
                await _db.SaveChangesAsync();

                ;
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new Exception($"user {user.Id} not found ", e);
            }
            await _db.SaveChangesAsync();

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