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); }
public ActionResult Edit(Album album) { if (ModelState.IsValid) { _db.Entry(album).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index"); } return View(album); }