public void CreateAlbum(Album album) { album.CreatedTime = DateTime.UtcNow; _albumRepo.Create(album); if (_uow.Commit() < 1) throw new Exception("Failed to create album."); }
public ActionResult Create(Album album) { if (ModelState.IsValid) { _albumSvc.CreateAlbum(album); return RedirectToAction("Index"); } ViewBag.GenreId = new SelectList(_genreSvc.GetGenres(), "GenreId", "Name", album.GenreId); ViewBag.ArtistId = new SelectList(_artistSvc.GetArtists(), "ArtistId", "Name", album.ArtistId); return View(album); }
public void UpdateAlbum(Album album) { album.UpdatedTime = DateTime.UtcNow; _albumRepo.Update( album, a => a.GenreId, a => a.ArtistId, a => a.Title, a => a.Price, a => a.AlbumArtUrl, a => a.UpdatedTime ); if (_uow.Commit() < 1) throw new Exception("Failed to update genre."); }