public ActionResult DeleteConfirmed(int id) { Payment_Method payment_Method = db.Payment_Method.Find(id); db.Payment_Method.Remove(payment_Method); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { Payment_Method payment_Method = await db.Payment_Method.FindAsync(id); db.Payment_Method.Remove(payment_Method); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "PaymentMethod_ID,PaymentMethod_Name,PaymentMethod_Description")] Payment_Method payment_Method) { if (ModelState.IsValid) { db.Entry(payment_Method).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(payment_Method)); }
public void Create(Payment_Method payment_method, User user) { Order newOrder = new Order(); newOrder.payment_method = payment_method; newOrder.user = user; this.context.Orders.Add(newOrder); context.SaveChanges(); }
public ActionResult Create([Bind(Include = "PaymentMethod_ID,PaymentMethod_Name,PaymentMethod_Description")] Payment_Method payment_Method) { if (ModelState.IsValid) { db.Payment_Method.Add(payment_Method); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(payment_Method)); }
public async Task <ActionResult> Edit([Bind(Include = "PaymentMethod_ID,PaymentMethod_Name")] Payment_Method payment_Method) { if (ModelState.IsValid) { db.Entry(payment_Method).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(payment_Method)); }
public async Task <ActionResult> Create([Bind(Include = "PaymentMethod_ID,PaymentMethod_Name")] Payment_Method payment_Method) { if (ModelState.IsValid) { db.Payment_Method.Add(payment_Method); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(payment_Method)); }
public void Create(int id, string card_nickname, string card_number, string expiration, int cvv) { Payment_Method newPaymentMethod = new Payment_Method(); newPaymentMethod.id = id; newPaymentMethod.card_nickname = card_nickname; newPaymentMethod.card_number = card_number; newPaymentMethod.expiration = expiration; newPaymentMethod.cvv = cvv; this.context.Payment_methods.Add(newPaymentMethod); context.SaveChanges(); }
// GET: Payment_Method/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Payment_Method payment_Method = db.Payment_Method.Find(id); if (payment_Method == null) { return(HttpNotFound()); } return(View(payment_Method)); }
// GET: Payment_Method/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Payment_Method payment_Method = await db.Payment_Method.FindAsync(id); if (payment_Method == null) { return(HttpNotFound()); } return(View(payment_Method)); }
public ActionResult Add(string key, string json) { var msg = new JsonMessage { Erros = false, Message = "Thêm mới dữ liệu thành công.!" }; if (key == Keyapi) { var model = new Payment_Method(); UpdateModel(model); _da.Add(model); _da.Save(); return(Json(msg, JsonRequestBehavior.AllowGet)); } else { msg = new JsonMessage { Erros = true, Message = "Có lỗi xảy ra.!" }; return(Json(msg, JsonRequestBehavior.AllowGet)); } }
public async Task <ActionResult <Order> > PostCart([FromBody] OrderItems order_json) { Order order = new Order(); try { Cart cart = new Cart(); cart.cart_total = order_json.cart_total; cart.item_total = order_json.item_total; _context.Carts.Add(cart); await _context.SaveChangesAsync(); User user = new User(); user = _context.Users.Find(order_json.user_id); foreach (var item in order_json.item_line) { Cart_Book_Line cart_book_line = new Cart_Book_Line(); cart_book_line.cart = cart; cart_book_line.book = _context.Books.Find(item.book_id); cart_book_line.ordered_qty = item.ordered_qty; cart_book_line.book_price = item.book_price; _context.Cart_Book_Line.Add(cart_book_line); await _context.SaveChangesAsync(); } foreach (var item in order_json.item_line_saved) { Saved_for_Later savedBook = new Saved_for_Later(); savedBook.book = _context.Books.Find(item.book_id); savedBook.user = _context.Users.Find(user.id); savedBook.saved_qty = item.saved_qty; _context.Saved_for_Later.Add(savedBook); await _context.SaveChangesAsync(); } var contextPO = _context.user_payment_options. Include(u => u.user). Include(p => p.payment_method). Where(p => p.user.id == order_json.user_id); Payment_Method payment = new Payment_Method(); payment = contextPO.FirstOrDefault <user_payment_options>().payment_method; order.user = user; order.payment_method = payment; _context.Orders.Add(order); await _context.SaveChangesAsync(); Cart_Order cart_order = new Cart_Order(); cart_order.cart = cart; cart_order.order = order; _context.Cart_Orders.Add(cart_order); await _context.SaveChangesAsync(); Cart_User cart_user = new Cart_User(); cart_user.cart = cart; cart_user.user = user; _context.Cart_User.Add(cart_user); await _context.SaveChangesAsync(); return(order); } catch (FormatException) { return(null); } }
public void Add(Payment_Method productSize) { FDIDB.Payment_Method.Add(productSize); }