public async Task <IActionResult> SaveUploadChanges(UpdateUploadViewModel model) { ModelState.Remove("Video.VideoFilePath"); ModelState.Remove("Video.User"); if (ModelState.IsValid) { try { var videoUpdate = _context.Video.SingleOrDefault(w => w.VideoId == model.Video.VideoId); videoUpdate.VideoTitle = model.Video.VideoTitle; videoUpdate.VideoTypeId = model.Video.VideoTypeId; _context.Video.Update(videoUpdate); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoExists(model.Video.VideoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
// GET: Videos/Edit/5 // Method called on Video/Index View // passes in VideoId selected public async Task <IActionResult> Edit(int id) { var user = await GetCurrentUserAsync(); UpdateUploadViewModel model = new UpdateUploadViewModel(_context, user, id); return(View(model)); }