public Book[] GetBooksSorter(BooksOrder[] order)
        {
            SorterHelper sorterHelper = new SorterHelper();

            Book[] booksOrdered = null;
            try
            {
                booksOrdered = sorterHelper.GetBooksSort(order);
            }
            catch (SortingServiceException ex)
            {
                SortingServiceExceptionDetail exceptionDetail = new SortingServiceExceptionDetail()
                {
                    Message = ex.Message
                };
                throw new FaultException <SortingServiceExceptionDetail>(exceptionDetail, new FaultReason(ex.Message));
            }

            return(booksOrdered);
        }
Example #2
0
        public HomeController()
        {
            _webmetu      = new WebDriverMetu();
            _sorterHelper = new SorterHelper();
            var pathDep  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files/json/department_data.json");
            var pathCour = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files/json/course_data.json");
            var pathSec  = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Files/json/section_data.json");

            using (StreamReader srD = new StreamReader(pathDep, Encoding.UTF8, true))
            {
                _departmentList = JsonConvert.DeserializeObject <List <DepartmentModel> >(srD.ReadToEnd());
            }
            using (StreamReader srC = new StreamReader(pathCour, Encoding.UTF8, true))
            {
                _courseList = JsonConvert.DeserializeObject <List <CourseModel> >(srC.ReadToEnd());
            }
            using (StreamReader srS = new StreamReader(pathSec, Encoding.UTF8, true))
            {
                _sectionList = JsonConvert.DeserializeObject <List <SectionModel> >(srS.ReadToEnd());
            }
        }