public JsonResult AddToCart(int productId, int quantity) { if (System.Web.HttpContext.Current.Session["Cart"] == null) { List <OrderCartDTO> newOrder = new List <OrderCartDTO>(); System.Web.HttpContext.Current.Session["Cart"] = newOrder; } List <OrderCartDTO> listOwnOrder = (List <OrderCartDTO>)System.Web.HttpContext.Current.Session["Cart"]; var product = new ProductServiceReference.ProductServiceClient(); OrderCartDTO order = new OrderCartDTO() { ID = listOwnOrder.Count + 1, Product = product.GetProductInformation(productId), Quantity = quantity }; listOwnOrder.Add(order); System.Web.HttpContext.Current.Session["Cart"] = listOwnOrder; return(Json(listOwnOrder)); }
public async Task <ActionResult> List() { HttpClient client = new HttpClient(); var size = new List <ControlBaseDTO>(); HttpResponseMessage response = await client.GetAsync(restServiceURL + "Size"); if (response.IsSuccessStatusCode) { size = await response.Content.ReadAsAsync <List <ControlBaseDTO> >(); HttpContext.Cache["SizeList"] = size; } ViewBag.ListSize = size; var serviceReference = new ProductServiceReference.ProductServiceClient(); var list = serviceReference.ListAllProductInformation(); HttpContext.Cache["PizzaList"] = list; ViewBag.ListProduct = list; return(View()); }
public ActionResult Details(ProductServiceReference.ProductB product) { ProductServiceReference.ProductServiceClient disClient = new ProductServiceReference.ProductServiceClient(); //disClient.GetProduct(product.ProductId); return(View()); }
public ActionResult Product() { var serviceReference = new ProductServiceReference.ProductServiceClient(); var list = serviceReference.ListAllProductInformation(); ViewBag.ListProduct = list; return(View()); }
public ActionResult Delete(ProductServiceReference.ProductB product) { ProductServiceReference.ProductServiceClient disClient = new ProductServiceReference.ProductServiceClient(); disClient.DeleteProduct(product.ProductId); return(View()); }
// GET: Product public ActionResult Index() { ProductServiceReference.ProductServiceClient obj = new ProductServiceReference.ProductServiceClient(); return(View(obj.GetAllProduct())); }
public ProductController() { authController = new AuthController(); productServiceClient = new ProductServiceReference.ProductServiceClient(); }