public async Task <int> Update(FarmerOrder order) { var cmd = QueriesCreatingHelper.CreateQueryUpdate(order); var rs = await DALHelper.Execute(cmd, dbTransaction : DbTransaction, connection : DbConnection); return(rs == 0 ? -1 : 0); }
private void SaveOrder(OrderModel model, Payment payment, string userId) { var order = new FarmerOrder(); order.OrderNumber = new Random().Next(111111, 999999).ToString(); order.OrderState = EnumOrderState.Completed; order.PaymentTypes = EnumPaymentTypes.CreditCart; order.PaymentId = payment.PaymentId; order.ConversationId = payment.ConversationId; order.OrderDate = DateTime.Now.ToLongDateString(); order.FirstName = model.FirstName; order.LastName = model.LastName; order.Email = model.Email; order.Phone = model.Phone; order.UserId = Convert.ToInt32(userId); order.City = model.City; order.OrderNote = model.OrderNote; foreach (var item in model.CartModel.CartItems) { var orderItem = new FarmerOrderItem() { Price = item.Price, Quantity = item.Quantity, ProductId = item.ProductId }; order.FarmerOrderItems.Add(orderItem); } _orderService.Create(order); }
public async Task <int> Add(FarmerOrder order) { var cmd = QueriesCreatingHelper.CreateQueryInsert(order); cmd += ";SELECT LAST_INSERT_ID();"; return((await DALHelper.ExecuteQuery <int>(cmd, dbTransaction: DbTransaction, connection: DbConnection)).First()); }
public IActionResult Add(FarmerOrder farmerOrder) { _orderService.Create(farmerOrder); return(Ok()); }