public ActionResult Edit([Bind(Include = "id_Songs,Tittle,Author,Link,Date,Id_Albums")] Song song) { if (ModelState.IsValid) { db.Entry(song).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Id_Albums = new SelectList(db.Albums, "id", "Tittle", song.Id_Albums); return(View(song)); }
public ActionResult Edit([Bind(Include = "Id_Albums,Tittle,Author,Date")] Album album) { if (ModelState.IsValid) { db.Entry(album).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(album)); }
public ActionResult Edit([Bind(Include = "id,id_Role,Username,Password,Email,Firstname,Lastname")] Login login) { if (ModelState.IsValid) { db.Entry(login).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RoleId = new SelectList(db.Roles, "Id", "Name", login.id_Role); return(View(login)); }
public ActionResult UserAcc([Bind(Include = "id,id_Role,Username,Password,Email,Firstname,Lastname")] Login login) { if (ModelState.IsValid) { db.Entry(login).State = EntityState.Modified; db.SaveChanges(); return(View("~/Views/Home/Index.cshtml")); } ViewBag.RoleId = new SelectList(db.Roles, "id_Role", "Name", login.id_Role); return(View("~/Views/Home/Index.cshtml")); }/// <summary>
public ActionResult Edit(PListViewModels pListViewModels) { if (pListViewModels == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { var update = db.Playlistas.Include(i => i.Songs).First(i => i.id == pListViewModels.Playlist.id); if (TryUpdateModel(update, "Playlist", new string[] { "id_User", "Playlist" })) { var song = db.Playlistas.Where(m => pListViewModels.SelectedSongs.Contains(m.id)).ToList(); var upSong = new HashSet <int>(pListViewModels.SelectedSongs); foreach (Song songE in db.Songs) { if (!upSong.Contains(songE.id)) { update.Songs.Remove(songE); } else { update.Songs.Add(songE); } } db.Entry(update).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); } return(View(pListViewModels)); }