public IEnumerable <Payable> GetReturnedBooksPayables() { ICollection <Payable> Payables = new List <Payable>(); using (var bookCopyRepo = new BookCopyRepository()) using (var transRepo = new BookTransactionInfoRepository()) using (var userRepo = new LibraryUserRepository()) { var trans = transRepo.GetReturnedBooksPayableTransactions(); foreach (var tran in trans) { Payable p = new Payable(); p.BookCopy = bookCopyRepo.FindById(tran.BookCopyId); p.TransactionInfo = tran; p.LibraryUserId = tran.LibraryUserId; p.AmountToPay = tran.AmountToPay; p.BookInvolved = _BookCopyService.GetBookInfo(tran.BookCopyId).BookTitle; p.UserInvolved = userRepo.FindById(tran.LibraryUserId).Fullname; Payables.Add(p); } return(Payables); } }
public LibraryUser FindById(object id) { using (var userRepo = new LibraryUserRepository()) { return(userRepo.FindById(id)); } }
public HttpResponseMessage DeleteMemberShipType(int id) { LibraryUserRepository LibraryUsers = new LibraryUserRepository(); LibraryUsers.DeleteLibraryUser(id); HttpResponseMessage ms = Request.CreateResponse(HttpStatusCode.Accepted); return(ms); }
public HttpResponseMessage UpdateMemberShipType([FromBody] LibraryUser _LibraryUser) { LibraryUserRepository LibraryUsers = new LibraryUserRepository(); LibraryUsers.UpdateLibraryUser(_LibraryUser); HttpResponseMessage ms = Request.CreateResponse(HttpStatusCode.OK); ms.Headers.Location = new Uri(Request.RequestUri + "/" + (_LibraryUser.LibraryUserID).ToString()); return(ms); }
public HttpResponseMessage GetAllMemberShipTypes() { LibraryUserRepository LibraryUsers = new LibraryUserRepository(); IEnumerable <LibraryUser> lsLibraryUsers; lsLibraryUsers = LibraryUsers.GetLibraryUsers(); if (lsLibraryUsers.Count() > 0) { return(Request.CreateResponse(HttpStatusCode.OK, lsLibraryUsers)); } { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Item not found")); } }
public HttpResponseMessage GetMemberShipTypesByID(int id) { LibraryUserRepository ctxLibraryUsers = new LibraryUserRepository(); LibraryUser _LibraryUser = ctxLibraryUsers.GetLibraryUsers().FirstOrDefault(x => x.LibraryUserID == id); if (_LibraryUser != null) { return(Request.CreateResponse(HttpStatusCode.OK, _LibraryUser)); } { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Item not found")); } }
/// <summary> /// Initializes a new instance of the UsersPageViewModel class. /// </summary> public UsersPageViewModel(LibraryUserService libraryUserService, DepartmentService departmentService, CourseService courseService) { _LibraryUserService = libraryUserService; _DepartmentService = departmentService; _CourseService = courseService; using (var repo = new LibraryUserRepository()) { items = new ObservableCollection <LibraryUser>(repo.GetAll()); ItemsCollectionView = CollectionViewSource.GetDefaultView(items); ItemsCollectionView.SortDescriptions.Add(new SortDescription("Fullname", ListSortDirection.Ascending)); } DepartmentSource = CollectionViewSource.GetDefaultView(new ObservableCollection <Department>(_DepartmentService.GetDepartments())); DepartmentSource.CurrentChanged += DepartmentSource_CurrentChanged; var courses = new ObservableCollection <Course>(courseService.GetAllCourses()); CoursesViewSource = CollectionViewSource.GetDefaultView(courses); }