public static CarInventoryView LoadOnInventoryId(int inventoryId)
 {
     CarInventoryViewSearch search = new CarInventoryViewSearch
     {
         InventoryId = inventoryId
     };
     return Search(search).FirstOrDefault();
 }
 public static IEnumerable<CarInventoryView> GetOnSearchFields(int? makeId, int? modelId, string state)
 {
     CarInventoryViewSearch search = new CarInventoryViewSearch
     {
         MakeId = makeId,
         ModelId = modelId,
         State = state
     };
     return Search(search);
 }
 public static IEnumerable<CarInventoryView> LoadAllActive()
 {
     CarInventoryViewSearch search = new CarInventoryViewSearch
     {
         InventoryDeleted= false,
         LocationDeleted =false,
         MakeDeleted =false,
         ModelDeleted = false
     };
     return Search(search);
 }
        /// <summary>
        /// Searches for CarMake
        /// </summary>
        /// <param name="item" />
        /// <returns>An IEnumerable set of CarMake</returns>
        public static IEnumerable<CarInventoryView> Search(CarInventoryViewSearch item)
        {
            List<SqlParameter> parameters
                = new List<SqlParameter>
                    {
                        new SqlParameter("@InventoryId", item.InventoryId),
                        new SqlParameter("@ModelId", item.ModelId),
                        new SqlParameter("@CarYear", item.CarYear),
                        new SqlParameter("@Quantity", item.Quantity),
                        new SqlParameter("@LocationId", item.LocationId),
                        new SqlParameter("@Color", item.Color),
                        new SqlParameter("@Price", item.Price),
                        new SqlParameter("@InventoryDeleted", item.InventoryDeleted),
                        new SqlParameter("@makeid", item.MakeId),
                        new SqlParameter("@ModelName", item.ModelName),
                        new SqlParameter("@ModelDeleted", item.ModelDeleted),
                        new SqlParameter("@MakeName", item.MakeName),
                        new SqlParameter("@MakeDeleted", item.MakeDeleted),
                        new SqlParameter("@Manufacturer", item.Manufacturer),
                        new SqlParameter("@Address", item.Address),
                        new SqlParameter("@City", item.City),
                        new SqlParameter("@State", item.State),
                        new SqlParameter("@LocationName", item.LocationName),
                        new SqlParameter("@Zip", item.Zip),
                        new SqlParameter("@LocationDeleted", item.LocationDeleted)
                    };

            if( item.CarImage != null)
            {
                parameters.Add(new SqlParameter("@CarImage", item.CarImage));
            }

            DataSet set = DataManager.ExecuteProcedure(KarzPlusConnectionString, "PKP_GetVKP_CarInventory", parameters);
            IEnumerable<DataRow> dataRows = set.GetRowsFromDataSet();
            return ConvertToEntityObject(dataRows);
        }
 /// <summary>
 /// Searches for CarInventoryView
 /// </summary>
 /// <param name="search" />
 /// <returns>An IEnumerable set of CarInventoryView</returns>
 public static IEnumerable<CarInventoryView> Search(CarInventoryViewSearch search)
 {
     return search == null ? new List<CarInventoryView>() : CarInventoryViewDao.Search(search);
 }