public void InsertAlbum(Album album) { album.Created = DateTime.Now; album.Updated = DateTime.Now; _context.Albums.Add(album); _context.SaveChanges(); }
public ActionResult Save(Album album) { if (ModelState.IsValid) { if (album.Id == Guid.Empty) { album.Id = Guid.NewGuid(); _albumService.InsertAlbum(album); } else { _albumService.UpdateAlbum(album); } return RedirectToAction("Index"); } return View(); }
public void InsertAlbum(Album album) { _albumRepository.InsertAlbum(album); }
public void UpdateAlbum(Album album) { album.Updated = DateTime.Now; _context.Entry(album).State = EntityState.Modified; _context.SaveChanges(); }
public void UpdateAlbum(Album album) { _albumRepository.UpdateAlbum(album); }