usingLuminance.Model;usingLuminanceApp.BaseClass;usingMySqlConnector;usingSystem;usingSystem.Collections.Generic;usingSystem.Data;namespace LuminanceApp.Models{publicclassUsersLocal : BaseModel{publicUsersLocal(){TableName="users_local";SetFillable("user_name","password","web_password","first_name","middle_name","last_name","is_active","user_type","division" );}publicvirtualintId{get;set;}publicvirtualstringUserName{get;set;}publicvirtualstringPassword{get;set;}publicvirtualstringWebPassword{get;set;}publicvirtualstringFirstName{get;set;}publicvirtualstringMiddleName{get;set;}publicvirtualstringLastName{get;set;}publicvirtualstringIsActive{get;set;}publicvirtualstringUserType{get;set;}publicvirtualstringDivision{get;set;}//get without where statementpublicDataTableGetNoWhere(){stringquery=@"";returnView(query);}//get with where statementpublicDataTableGetUsersWhereAdmin(string_user_type){stringquery=@" SELECT * FROM users_localWHEREuser_type=?_user_type";varwhere=newDictionary<string,object>{{"_user_type",_user_type}};returnView(query,where); }//this is an example if you want a custom query, especially thos with inner joins.publicDataTableGetUsersWhereAdmin() //you can pass an argument exanmple the "user_type" for the where{ string query= @" SELECT u.id AS Id, u.user_name AS UserName, u.first_name AS FirstName, u.middle_name MiddleName, u.last_name AS LastName, u.user_type UserType, u.password Password, u.is_active IsActive r.last_name AS LastName, r.user_type UserType, r.is_active IsActive FROM users_local u LEFT JOIN user_access r ON u.role_id=r.id WHERE u.user_type=?user_typeANDu.is_active=?is_active";varwhere=newDictionary<string,object>{{"user_type","Administrator"},{"is_active","Y"}};returnView(query,where); }//this is an example if you want a custom query, especially thos with inner joins.publicDataTableGetAllUsers() //no where{ string query= @" SELECT u.id AS Id, u.user_name AS UserName, u.first_name AS FirstName, u.middle_name MiddleName, u.last_name AS LastName, u.user_type UserType, u.password Password, u.is_active IsActive FROM users_local u"; return View(query); } }}