public IActionResult Remove([FromRoute] string Id) { RemoveSongViewModel removeViewModel = new RemoveSongViewModel() { Id = Id }; return(PartialView("_RemoveSongPartial", removeViewModel)); }
public IActionResult Remove(RemoveSongViewModel removeData) { songService.RemoveSong(removeData.Id); return(RedirectToAction("Index")); //return PartialView("_RemoveSongPartial", removeData); }
public IActionResult Remove(RemoveSongViewModel removeData) { var song = songService.GetSongById(removeData.Id); context.Wishlist.FirstOrDefault().Songs.Remove(song); context.SaveChanges(); return(RedirectToAction("Index")); //return PartialView("_RemoveSongPartial", removeData); }
public IActionResult Remove(RemoveSongViewModel removeData) { var song = songService.GetSongById(removeData.Id); context.Carts.FirstOrDefault().Songs.Remove(song); song.NumberInCart = 0; context.Carts.FirstOrDefault().total -= song.Price; context.SaveChanges(); return(RedirectToAction("Index")); //return PartialView("_RemoveSongPartial", removeData); }
public IActionResult AddToWishlist([FromRoute] string id) { RemoveSongViewModel removeViewModel = new RemoveSongViewModel() { Id = id }; var song = songService.GetSongById(id); var wishlist = context.Wishlist.FirstOrDefault(); wishlist.Songs.Add(song); context.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Add([FromRoute] string id) { RemoveSongViewModel removeViewModel = new RemoveSongViewModel() { Id = id }; var song = songService.GetSongById(id); var cart = context.Carts.FirstOrDefault(); if (cart.Songs.Any(p => p.Id.ToString() == id)) { song.NumberInCart++; context.Carts.FirstOrDefault().total += song.Price; } context.SaveChanges(); return(RedirectToAction("Index")); }