// GET: Learning/AddSource/5 public async Task <IActionResult> AddSource() { SourceModel source = new SourceModel(); if (await TryUpdateModelAsync(source)) { await source.GetItems(_context); LearningSet set = _context.LearningSets.Single(x => x.LearningSetID == source.LearningSetID); set.NumberOfItems = set.Items.Count(); await _context.SaveChangesAsync(); } return(RedirectToAction("Edit", "LearningSets", routeValues: new { source.LearningSetID })); }