public async Task <IActionResult> Edit(int id, [Bind("SubmitID,TaskID,SubmitName,SubmitDescription,SubmitTime,SubmitScore")] SubmitModel submitModel)
        {
            if (id != submitModel.SubmitID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(submitModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SubmitModelExists(submitModel.SubmitID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("SubmitList", new { TaskID = submitModel.TaskID }));
            }
            return(View(submitModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UserID,UserName,UserEmail,UserPassword,UserRole")] AccountModel accountModel)
        {
            if (id != accountModel.UserID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accountModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountModelExists(accountModel.UserID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(accountModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ContentID,CourseID,ContentName,ContentDescription")] ContentModel contentModel)
        {
            if (id != contentModel.ContentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contentModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContentModelExists(contentModel.ContentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contentModel));
        }
Пример #4
0
        public async Task <IActionResult> Edit(int id, [Bind("TaskID,TaskName,TaskDescription,TaskDeadline,TaskCourse,TaskTeacher")] TaskModel taskModel)
        {
            if (id != taskModel.TaskID)
            {
                return(NotFound());
            }

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