public static List <ShowCatAndSubcatModel> SearchSubcategory(string name) { try { ShowCatAndSubcatModel showCatAndSubcatModel = new ShowCatAndSubcatModel() { Subcategory = name }; return(SubcategoryConnection.SearchSubcategory(showCatAndSubcatModel)); } catch (Exception ex) { throw; } }
public static List <ShowCatAndSubcatModel> SearchSubcategory(ShowCatAndSubcatModel showCatAndSubcatModel) { try { using (IDbConnection cnn = new SQLiteConnection(LoadConnectionString())) { var output = cnn.Query <ShowCatAndSubcatModel>("SELECT Id_Subcategory, C.Name as Category, S.Name as Subcategory " + "FROM Tbl_Subcategory S INNER JOIN Tbl_Category C ON S.Id_Category = C.Id_Category WHERE S.Name like @Subcategory", showCatAndSubcatModel); return(output.ToList()); } } catch (Exception ex) { throw; } }