Пример #1
0
        //Takes in a course
        public async Task <Course> UpdateCourse(Course updatedCourse)
        {
            var addedCourse = _classDbContext.Update(updatedCourse);
            await _classDbContext.SaveChangesAsync();

            return(updatedCourse);
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("AssessmentId,Name,Date,Points")] Assessment assessment)
        {
            if (id != assessment.AssessmentId)
            {
                return(NotFound());
            }

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