Пример #1
0
        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);
            }
        }
Пример #2
0
 public ActionResult AddPictures(Album a)
 {
     return View(a);
 }
Пример #3
0
 public ActionResult EditAlbum(Album editAlbum)
 {
     if (ModelState.IsValid)
     {
         HomeController.newsDB.Entry(editAlbum).State = EntityState.Modified;
         HomeController.newsDB.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(editAlbum);
 }