예제 #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,StartDate,Description")] Course course)
        {
            if (id != course.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _repository.UpdateEntity(course);
                    await _repository.SaveAllAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _repository.CourseExistsAsync(course.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }