public ActionResult Edit(Invoice invoice) { try { // TODO: Add update logic here invoice = APIConsumer <Invoice> .GetObject(PATH, invoice.Id.ToString()); if (invoice.IsPaid == false) { invoice.IsPaid = true; } else { invoice.IsPaid = false; } APIConsumer <Models.Webshop.Invoice> .EditObject(PATH, invoice.Id.ToString(), invoice); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: Product/Details/5 public ActionResult Details(int id) { Product product = APIConsumer <Product> .GetObject("product", id.ToString()); IEnumerable <Course> courses = this.courses.Where(i => i.ProductId == product.Id); product.Courses = courses.ToList(); return(View(product)); }
// GET: Invoice/Delete/5 public ActionResult Delete(int id) { Invoice invoice = APIConsumer <Invoice> .GetObject(PATH, id.ToString()); if (invoice.Deleted == false) { return(View(invoice)); } else { return(RedirectToAction("DeletedIndex")); } }
public ActionResult Delete(Invoice invoice) { try { // TODO: Add delete logic here invoice = APIConsumer <Invoice> .GetObject(PATH, (invoice.Id).ToString()); invoice.Deleted = true; APIConsumer <Models.Webshop.Invoice> .EditObject(PATH, invoice.Id.ToString(), invoice); return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: MyOrder public ActionResult Details(int id) { orderDetails = new List <ShoppingCart>(); decimal total = 0; foreach (Invoice item in invoices) { if (item.Email == user.Email) { foreach (InvoiceDetail detail in details) { if (detail.InvoiceId == id) { if (detail.ProductId != 0) { Product products = APIConsumer <Product> .GetObject("product", detail.ProductId.ToString()); total += (products.Price * detail.Pieces); orderDetails.Add(new ShoppingCart() { Product = products, Quantity = detail.Pieces }); } if (detail.CourseId != 0) { Course courses = APIConsumer <Course> .GetObject("course", detail.CourseId.ToString()); total += (courses.Price * detail.Pieces); orderDetails.Add(new ShoppingCart() { Course = courses, Quantity = detail.Pieces }); } } } ViewBag.total = total; break; } } return(View(orderDetails)); }
// GET: Invoice/Edit/5 public ActionResult Edit(int id) { Invoice invoice = APIConsumer <Invoice> .GetObject(PATH, id.ToString()); string email = invoice.Email; string surname = invoice.Surname; string firstname = invoice.Firstname; if (invoice.Deleted == false) { invoice.Email = email; invoice.Surname = surname; invoice.Firstname = firstname; return(View(invoice)); } else { return(RedirectToAction("DeletedIndex")); } }
public ActionResult Edit(int id) { ViewBag.products = products; return(View(APIConsumer <Course> .GetObject("course", id.ToString()))); }
public ActionResult Details(int id) { return(View(APIConsumer <Course> .GetObject("course", id.ToString()))); }
public ActionResult Buy(int id, bool?getBool) { if (getBool == false) { Course courses = APIConsumer <Course> .GetObject("course", id.ToString()); if (Session["cart"] == null) { List <ShoppingCart> cart = new List <ShoppingCart>(); cart.Add(new ShoppingCart() { Course = courses, Quantity = 1 }); Session["cart"] = cart; Session["count"] = 1; } else { List <ShoppingCart> cart = (List <ShoppingCart>)Session["cart"]; int index = ItemExists(id, false); if (index != -1) { cart[index].Quantity++; Session["count"] = Convert.ToInt32(Session["count"]) + 1; } else { cart.Add(new ShoppingCart() { Course = courses, Quantity = 1 }); Session["count"] = Convert.ToInt32(Session["count"]) + 1; } Session["card"] = cart; } return(RedirectToAction("Index", "Course")); } if (getBool == true) { Product products = APIConsumer <Product> .GetObject("product", id.ToString()); if (Session["cart"] == null) { List <ShoppingCart> cart = new List <ShoppingCart>(); cart.Add(new ShoppingCart() { Product = products, Quantity = 1 }); Session["cart"] = cart; Session["count"] = 1; } else { List <ShoppingCart> cart = (List <ShoppingCart>)Session["cart"]; int index = ItemExists(id, true); if (index != -1) { cart[index].Quantity++; Session["count"] = Convert.ToInt32(Session["count"]) + 1; } else { cart.Add(new ShoppingCart() { Product = products, Quantity = 1 }); Session["count"] = Convert.ToInt32(Session["count"]) + 1; } Session["card"] = cart; } return(RedirectToAction("Index", "Product")); } return(null); }
public ActionResult Delete(int id) { return(View(APIConsumer <Product> .GetObject(PATH, id.ToString()))); }
// GET: ProductPrice/Edit/5 public ActionResult Edit(int id) { return(View(APIConsumer <ProductPrice> .GetObject(PATH, id.ToString()))); }
// GET: Invoice/Details/5 public ActionResult Details(int id) { return(View(APIConsumer <Invoice> .GetObject(PATH, id.ToString()))); }