/// <summary> /// Create a basic instance of the search Controller for test /// </summary> /// <param name="undefinedDAO"></param> /// <param name="undefinedDB"></param> /// <param name="cm"></param> /// <param name="undefinedManager"></param> /// <param name="ApiContext"></param> public searchController(IundefinedDAO undefinedDAO, IundefinedDB undefinedDB, IConnectionManager cm, IundefinedManager undefinedManager, WebApiContext ApiContext) : base() { _cm = cm; _IundefinedDAO = undefinedDAO; _IundefinedDB = undefinedDB; _Iundefinedmanager = undefinedManager; _ApiContext = ApiContext; }
public HttpResponseMessage Getsearch() { //When API is called from a test class if (ApiContext == null) { ApiContext = _ApiContext; } //When API is NOT called from test class if (_undefinedDAO == null) { _undefinedDAO = new undefinedDAO(ApiContext, _undefinedDB); } if (_cm == null) { _cm = new ConnectionManager(); } if (_undefinedmanager == null) { _undefinedmanager = new undefinedManager(_cm, _undefinedDAO, ApiContext); } Isearch prototype = new search(); //Get search list from the database List <Isearch> list = _undefinedmanager.Getsearch(inputObjects, globals, prototype); if (list == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "NOT_FOUND")); } IApiResponse <List <Isearch> > result = new ApiResponse <List <Isearch> >(); result.Records = list; result.TotalRecords = list.Count; result.MessageId = 200; result.MessageText = "Success"; return(Request.CreateResponse <IApiResponse <List <Isearch> > >(HttpStatusCode.OK, result)); }
/// <summary> /// Create a basic instance of the BudgetModel Manager class /// </summary> /// <param name="cm">A reference to an initialized Connection Manager</param> /// <param name="dao">A reference to an initialized Roles DAO</param> /// <param name="context">A reference to an initialized Web API Context</param> public undefinedManager(IConnectionManager cm, IundefinedDAO dao, WebApiContext context) : base(context) { _cm = cm; _dao = dao; }