Exemple #1
0
        public ActionResult Create(Album album)
        {
            if (ModelState.IsValid)
            {
                album.Opprettet = DateTime.Now;
                var user = _db.Users.FirstOrDefault(x => x.Username == User.Identity.Name);
                album.OpprettetAv = user;
                _db.Albums.Add(album);
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(album);
        }
Exemple #2
0
 public ActionResult Edit(Album album)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(album).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(album);
 }