public override void OnViewAppearing() { base.OnViewAppearing(); Movie = InputArgs["Movie"] as Movie; MovieOnCart = CartService.HasMovieOnCart(Movie.Id); }
void AddToCart() { if (CartService.HasMovieOnCart(Movie.Id)) { CartService.RemoveFromCart(Movie.Id); MovieOnCart = false; } else { CartService.AddToCart(Movie.Id, Movie.Price); MovieOnCart = true; } }
void SearchByBarcode(string barCode) { var movie = MoviesService.FindByBarcode(barCode); if (movie == null) { SetResult(new ErrorResult("No se ha encontrado la pelicula")); return; } if (CartService.HasMovieOnCart(movie.Id)) { SetResult(new ErrorResult("Ya tiene esa pelicula en su carrito")); return; } CartService.AddToCart(movie.Id, movie.Price); SetResult(new SuccessResult("Se ha agregado la pelicula correctamente")); }