public void Should_Throw_Exception_When_Order_IsNull_AddOrderTest() { // Arrange Order order = null; // Act & Assert Assert.Throws <Exception>(() => target.AddOrder(order)); }
//[AcceptVerbs("GET", "POST")] public IHttpActionResult AddOrder(OrderDto am) { try { OM.AddOrder(am); Console.WriteLine("dfd"); return(Ok("pppp0")); } catch (Exception e) { return(BadRequest(e.ToString())); } }
public ActionResult AddOrder() { bool result = _OrderLogic.AddOrder(); if (result) { Session["CartItems"] = null; Session["CartCount"] = null; return(RedirectToAction("Index")); } return(View("ShoppingCart")); }
public IActionResult AddOrder(OrderModel orderModel) { try { OrderModel addedOrder = logic.AddOrder(orderModel); return(Created("api/orders/" + addedOrder.ID, addedOrder)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public void PlaceOrderMethod(object param) { if (ProductsInCart.Count == 0) { MessageBox.Show("Your cart is empty!"); } else { OrderLogic orderLogic = new OrderLogic(); if (orderLogic.AddOrder(productsInCart.ToList(), Total)) { MessageBox.Show("Order placed successfully"); } else { MessageBox.Show("Not enough quantity in store!"); } } }
public IActionResult Checkout(OrderViewModel model) { Order order = new Order { GameList = OrderLogic.GetShoppingList(), OrderStatus = OrderStatus.Waiting, Address = model.Address, OrderDate = model.Order.OrderDate }; var email = HttpContext.Session.GetString("_Name"); order.UserId = AccountLogic.GetUser(email).Id; OrderLogic.AddOrder(order); int orderId = OrderLogic.GetOrderId(); OrderLogic.AddGamesOrder(order.GameList, orderId); OrderLogic.ClearShoppingList(); return(RedirectToAction("Index", "Home")); }
public ActionResult AddOrder(int?id) { var clientID = Request.Form["User.Id"]; var hostID = Request.Form["Verkoper.Id"]; var quantity = Request.Params["Quantity"]; string message = ""; Product product = PLogic.ByID(Convert.ToInt32(id)); message = OLogic.AddOrder(Convert.ToInt32(clientID), Convert.ToInt32(hostID), Convert.ToInt32(id), Convert.ToInt32(quantity)) + OLogic.KoppelTabelOrder(Convert.ToInt32(clientID), Convert.ToInt32(hostID), Convert.ToInt32(id), Convert.ToInt32(quantity)); if (message == "succes") { Session["Order"] = message; return(RedirectToAction("ViewProducts", "Product")); } return(View()); }