public static void AddNewStoreOrder(this Order order, CartItemViewModel model) { try { StoreOrder storeOrder = new StoreOrder(); storeOrder.Store_Id = model.StoreId; storeOrder.OrderNo = Guid.NewGuid().ToString("N").ToUpper(); storeOrder.AddNewOrderItem(model); order.StoreOrders.Add(storeOrder); } catch (Exception) { throw; } }
public static void AddNewStoreOrder(this Order order, CartItemViewModel model, DunkeyContext ctx) { try { StoreOrder storeOrder = new StoreOrder(); storeOrder.Store_Id = model.StoreId; storeOrder.OrderNo = Guid.NewGuid().ToString("N").ToUpper(); storeOrder.AddNewOrderItem(model, ctx); var businessTypeTax = ctx.BusinessTypeTax.FirstOrDefault(x => x.BusinessType == ctx.Stores.FirstOrDefault(x1 => x1.Id == model.StoreId).BusinessType); if (businessTypeTax != null) { storeOrder.BusinessTypeTax = businessTypeTax.Tax; storeOrder.BusinessType = businessTypeTax.BusinessType; } order.StoreOrders.Add(storeOrder); } catch (Exception ex) { DunkeyDelivery.Utility.LogError(ex); } }