public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder, List <BodyObject> requestBody) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetBookPaging", pageIndex, pageSize, sortColumn, sortOrder); var books = dt.AsEnumerable().Select(row => new Book() { Id = (int)row["id"], BookCode = (string)row["bookcode"], BookName = (string)row["bookname"], Inventory = (int)row["inventory"], Author = (string)row["author"], MainContent = (string)row["maincontent"], Description = (string)row["description"], BookCategory_Id = (int)row["bookcategory_id"], IsActive = (bool)row["isactive"], Image = (string)row["image"] }).ToList(); return(books); } catch (Exception ex) { throw new Exception("Error from BookDAL: " + ex.Message.ToString()); } }
public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetStudentPaging", pageIndex, pageSize, sortColumn, sortOrder); var students = dt.AsEnumerable().Select(row => new Student() { Id = (int)row["id"], StudentCode = (string)row["studentcode"], StudentName = (string)row["studentname"], Class = (string)row["class"], DoB = (DateTime)row["dob"], NativeLand = (string)row["nativeland"], Course = (string)row["course"], Faculty = (string)row["faculty"], Description = (string)row["description"], IsActive = (bool)row["isactive"] }).ToList(); return(students); } catch (Exception ex) { throw new Exception("Error from StudentDAL: " + ex.Message.ToString()); } }
public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetUserPaging", pageIndex, pageSize, sortColumn, sortOrder); var users = dt.AsEnumerable().Select(row => new User() { Id = (int)row["id"], Username = (string)row["username"], Description = (string)row["description"], IsActive = (bool)row["isactive"] }).ToList(); return(users); } catch (Exception ex) { throw new Exception("Error from UserDAL: " + ex.Message.ToString()); } }
public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetBookCategoryPaging", pageIndex, pageSize, sortColumn, sortOrder); var bookCategories = dt.AsEnumerable().Select(row => new BookCategory() { Id = (int)row["id"], BookCategoryCode = (string)row["bookcategorycode"], BookCategoryName = (string)row["bookcategoryname"], Description = (string)row["description"], IsActive = (bool)row["isactive"], }).ToList(); return(bookCategories); } catch (Exception ex) { throw new Exception("Error from BookCategoryDAL: " + ex.Message.ToString()); } }
public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetPostPaging", pageIndex, pageSize, sortColumn, sortOrder); var posts = dt.AsEnumerable().Select(row => new Post() { Id = (int)row["id"], CodePost = (string)row["codepost"], Message = (string)row["message"], Description = (string)row["description"], IsActive = (bool)row["isactive"], }).ToList(); return(posts); } catch (Exception ex) { throw new Exception("Error from PostDAL: " + ex.Message.ToString()); } }
public IEnumerable <Object> GetAllPaging(int pageIndex, int pageSize, string sortColumn, int sortOrder, List <BodyObject> requestBody) { try { ProviderDAL providerDAL = new ProviderDAL(); DataTable dt = providerDAL.GetDataPaging("spGetBorrowBookPaging", pageIndex, pageSize, sortColumn, sortOrder); var borrowBooks = dt.AsEnumerable().Select(row => new BorrowBook() { Id = (int)row["id"], BorrowBookCode = (string)row["borrowbookcode"], BorrowDate = (DateTime)row["borrowdate"], NumberOfDayBorrow = (int)row["numberofdayborrow"], Description = (string)row["description"], Student_Id = (int)row["student_id"], IsReturn = (bool)row["isreturn"] }).ToList(); return(borrowBooks); } catch (Exception ex) { throw new Exception("Error from borrowBookDAL: " + ex.Message.ToString()); } }