public string SaveOrder(Entity.OrderMaster odr, List <Entity.TransactionOrderDetails> oderList)
        {
            string message = string.Empty;

            try
            {
                Data.OrderMaster dataobj = new OrderMaster();
                dataobj.CustomerName = odr.CustomerName;
                dataobj.Contact      = Convert.ToDecimal(odr.Contact);
                dataobj.OrderDate    = DateTime.Now;
                dataobj.EmailId      = odr.EmailId;
                dbContext.OrderMasters.InsertOnSubmit(dataobj);
                dbContext.SubmitChanges();
                int OrderID = dataobj.OrderID;
                List <TransactionOrderDetail> dataoderList = new List <TransactionOrderDetail>();
                foreach (var data in oderList)
                {
                    TransactionOrderDetail objode = new TransactionOrderDetail();
                    objode.OrderID       = OrderID;
                    objode.ItemId        = data.ItemId;
                    objode.OrderQuentity = data.OrderQuentity;
                    dataoderList.Add(objode);
                }
                dbContext.TransactionOrderDetails.InsertAllOnSubmit(dataoderList);
                dbContext.SubmitChanges();
                message = OrderID.ToString();
            }
            catch (Exception ex)
            {
                message = "Error";
            }

            return(message);
        }
Beispiel #2
0
 partial void UpdateTransactionOrderDetail(TransactionOrderDetail instance);
Beispiel #3
0
 partial void DeleteTransactionOrderDetail(TransactionOrderDetail instance);
Beispiel #4
0
 partial void InsertTransactionOrderDetail(TransactionOrderDetail instance);