public List <OrderVM> OrderListSP(string customerId) { try { List <OrderVM> aList = new List <OrderVM>(); var dbConnection = _sqlConnService.OpenConnection(); List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@userId", customerId)); SqlDataReader dataReader = _sqlConnService.GetSqlDataReader("sp_Get_OrderByUserId", parameters); while (dataReader.Read()) { OrderVM orderVM = new OrderVM(); orderVM.OrderId = Convert.ToInt32(dataReader["OrderId"]); orderVM.FullName = dataReader["FullName"].ToString(); orderVM.UserName = dataReader["UserName"].ToString(); orderVM.OrderDate = Convert.ToDateTime(dataReader["OrderDate"]); orderVM.OrderAmount = Convert.ToDecimal(dataReader["OrderAmount"]); orderVM.OrderItems = Convert.ToInt32(dataReader["OrderItems"]); aList.Add(orderVM); } return(aList); } catch (Exception ex) { throw; } finally { _sqlConnService.CloseConnection(); } }