Ejemplo n.º 1
0
        public string SearchCourse(string pRequest)
        {
            var rd     = new APIResponse <SearchCourseRD>();
            var rdData = new SearchCourseRD();
            var rp     = pRequest.DeserializeJSONTo <APIRequest <SearchCourseRP> >();

            if (rp.Parameters == null)
            {
                throw new ArgumentException();
            }

            if (rp.Parameters != null)
            {
                rp.Parameters.Validate();
            }

            var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);

            try
            {
                MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(loggingSessionInfo);
                DataTable         dTbl      = courseBll.SearchOnlineCourse(rp.Parameters.Keyword, 0, 3000);
                if (dTbl != null)
                {
                    rdData.CourseList = DataTableToObject.ConvertToList <OnlineCourse>(dTbl);
                }
                rd.ResultCode = 0;
            }
            catch (Exception ex)
            {
                rd.ResultCode = 103;
                rd.Message    = ex.Message;
            }
            rd.Data = rdData;
            return(rd.ToJSON());
        }