public ActionResult Edit([Bind(Include = "VideoID,VideoTitle,VideoUrl,VideoUploader,VideoUploadDate,VideoViews,VideoDuration,VideoThumbnail,VideoDescription")] Video video) { if (ModelState.IsValid) { db.Entry(video).State = EntityState.Modified; db.SaveChanges(); return(Json(video)); } var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); return(Json(errors)); }
public SearchRequestDb Update(SearchRequestDb request) { var requestFromDb = _context.SearchRequests.Find(request.Id); var videosFromDb = new List <ResultVideoDb>(); foreach (var video in request.Videos) { videosFromDb.Add(_context.Videos.Find(video.Id)); } requestFromDb.Videos = videosFromDb; _context.Entry(requestFromDb).State = EntityState.Modified; _context.SaveChanges(); return(requestFromDb); }
public ActionResult Edit([Bind(Include = "PlaylistID,PlaylistName")] Playlist playlist) { if (ModelState.IsValid) { db.Entry(playlist).State = EntityState.Modified; db.SaveChanges(); return(Json(playlist)); } var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); return(Json(errors)); }