static void Main(string[] args) { //list of all movies System.Console.WriteLine("All movies:"); Manager.GetAllMovies().ForEach(m => { System.Console.WriteLine(m.Title); }); //to choose title and add to basket while (true) { System.Console.WriteLine("Please input movie title or 'stop'."); string userinput = System.Console.ReadLine(); if (userinput == "stop" || userinput == "STOP") { break; } else { var timing = Manager.GetTimetable(); System.Console.WriteLine("Choose time"); var usertime = System.Console.ReadLine(); if (timing == null) { System.Console.WriteLine("Time not available, please choose different time."); } else { Basket.AddToBasket(userinput); } } } }
public ActionResult Add(string productId) { if (!Request.IsAjaxRequest()) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (string.IsNullOrEmpty(productId)) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var product = productManager.GetById(productId); if (product == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (product.Stock == 0) { return(Json(new AddToBasketResultViewModel { Success = false, ProductId = productId, Message = "Product is out of stock" }, JsonRequestBehavior.AllowGet)); } basketManager.AddToBasket(User.Identity.GetUserId(), productId); return(Json(new AddToBasketResultViewModel { Success = true, ProductId = productId, Message = "Added to basket" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddToBasket(int id) { basketManager.AddToBasket(id); return(RedirectToAction("Index")); }