Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,ContentUrl,AnnouncedUser,AnnouncedDate")] Notice notice)
        {
            if (id != notice.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(notice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NoticeExists(notice.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(notice));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserNum,UserName,UserSex,PassWord,UserClass,UserAcademy,UserGroup,UserPhone,QQ,WeChat,UserEmail,UserPositionType,UserPosition,UserStatus,UserMaster,UserApprentice,UserLable")] User user)
        {
            if (id != user.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Пример #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,UserNum,UserName,UserSex,UserAcademy,UserClass,UserPhone,QQ,WeChat,UserEmail,Interest,UserLable")] Registration registration)
        {
            if (id != registration.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrationExists(registration.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(registration));
        }