public JsonResult Create(List <OrderDetails> orderDetails, Customer customer) { try { customer.Gender = "Male"; customer.IdentityCard = "887799445511"; customer.Address = "HCM"; customer.DateOfBirth = DateTime.Now; var customerCreated = _customerClient.Create(customer); var empl = _employeeClient.GetEmployee(Convert.ToInt32(Session["UserId"])); var order = new Order { Customer = customerCreated.Id, Seller = empl.Id, OrderDate = DateTime.Now, OrderDetails = orderDetails, }; var orderCreated = _orderClient.CreateOrder(order); foreach (var item in orderDetails) { var orderDetail = new OrderDetails { OrderId = orderCreated.Id, ProductId = item.ProductId, Quantity = item.Quantity, }; var detailsCreated = _orderClient.CreateOrderDetail(orderDetail); } return(Json(new { url = Url.Action("UserProfile", "Employee") }, JsonRequestBehavior.AllowGet)); } catch (Exception) { return(Json(new { url = Url.Action("Index", "Home") }, JsonRequestBehavior.AllowGet)); } }