Ejemplo n.º 1
0
 public ActionResult Edit(Album album)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(album).State = EntityState.Modified;
         //db.SaveChanges();
         _albums.Update(album);
         _unitOfWork.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GenreId  = new SelectList(_genres.Get(), "GenreId", "Name", album.GenreId);
     ViewBag.ArtistId = new SelectList(_artists.Get(), "ArtistId", "Name", album.ArtistId);
     return(View(album));
 }
Ejemplo n.º 2
0
        public OperationStatus Update(Album album)
        {
            var status = new OperationStatus();

            if (_repository.IsAlbumExist(album.Name, album.UserId))
            {
                status.ErrorMessage = "Album with such name is already exists";

                return(status);
            }

            _repository.Update(album);

            status.IsSuccessful = true;
            return(status);
        }