public ActionResult AddAlbum(CreateAlbumModel model) { if (ModelState.IsValid) { // Add the album //TEST PICTURES Album temp = new Album { Id = 1, AlbumName = model.AlbumName, Description = model.Description, time = System.DateTime.Now.TimeOfDay.ToString(), date = System.DateTime.Today.Date.ToString() }; HomeController.newsDB.Albums.Add(temp); HomeController.newsDB.SaveChanges(); //Successful return RedirectToAction("AlbumDetail", HomeController.newsDB.Albums.Find(temp.Id)); } else { //Error return View(model); } }
public ActionResult AddPictures(Album a) { return View(a); }
public ActionResult EditAlbum(Album editAlbum) { if (ModelState.IsValid) { HomeController.newsDB.Entry(editAlbum).State = EntityState.Modified; HomeController.newsDB.SaveChanges(); return RedirectToAction("Index"); } return View(editAlbum); }