public int PostOrderCreate(string combindedString, OrderCreateInfVm order) { try { string connection = Constants.Connection; int i = 0; using (SqlConnection sqlConn = new SqlConnection(connection)) { if (sqlConn.State == 0) { sqlConn.Open(); } using (SqlCommand sqlComm = new SqlCommand("USP_INS_CREATE_ORDER", sqlConn)) { sqlComm.CommandType = System.Data.CommandType.StoredProcedure; sqlComm.Parameters.AddWithValue("@ArtCodeString", combindedString); sqlComm.Parameters.AddWithValue("@CustomerID", order.CustomerId); sqlComm.Parameters.AddWithValue("@ShipAddrID", order.ShipmentAddId); sqlComm.Parameters.AddWithValue("@BillingAddrID", order.BillingAddId); sqlComm.Parameters.AddWithValue("@Remarks", ""); sqlComm.Parameters.AddWithValue("@PaymnetType", order.PaymentType); sqlComm.Parameters.AddWithValue("@PaidAmt", order.PaidAmount); i = sqlComm.ExecuteNonQuery(); sqlConn.Close(); return(i); } } } catch (Exception ex) { throw ex; } }
public int PostOrderCreate(CreateOrderVm model) { try { OrderCreateInfVm order = new OrderCreateInfVm(); order.CustomerId = model.CustomerId; order.ShipmentAddId = model.ShipmentAddId; order.BillingAddId = model.BillingAddId; order.PaymentType = model.PaymentType; order.PaidAmount = model.PaidAmount; string[] array = model.ArticleCodeStrings.ToArray(); string combindedString = string.Join(",", array); var res = _unitOfWork.OrderCreate.PostOrderCreate(combindedString, order); return(res); } catch (Exception ex) { throw ex; } }