public Successful()
 {
     db      = new EFInMemoryDatabase();
     context = db.CreateDataContext <EFDataContext>();
     efBookCategoryRepository = new EFBookCategoryRepository(context);
     efUnitOfWork             = new EFUnitOfWork(context);
     sut = new BookCategoryAppService(efBookCategoryRepository, efUnitOfWork);
 }
Example #2
0
        public BookCategoryServiceTests()
        {
            var db = new EFInMemoryDatabase();

            context                 = db.CreateDataContext <EFDataContext>();
            readContext             = db.CreateDataContext <EFDataContext>();
            _bookCategoryRepository = new EFBookCategoryRepository(context);
            _unitOfWork             = new EFUnitOfWork(context);
            sut = new BookCategoryAppService(_bookCategoryRepository, _unitOfWork);
        }
Example #3
0
        public async Task <IActionResult> Delete([FromServices] BookCategoryService service, int id)
        {
            try
            {
                var item = await service.Delete(id);

                return(Ok(item));
            }
            catch (HttpResponseException err)
            {
                return(err.ToResponse());
            }
            catch (Exception err)
            {
                return(StatusCode(SERVER_ERROR_CODE, err.Message));
            }
        }
Example #4
0
        public async Task <IActionResult> Post([FromServices] BookCategoryService service, [FromBody] BookCategory input)
        {
            try
            {
                var item = await service.Store(input);

                return(Ok(item));
            }
            catch (HttpResponseException err)
            {
                return(err.ToResponse());
            }
            catch (Exception err)
            {
                return(StatusCode(SERVER_ERROR_CODE, err.Message));
            }
        }
Example #5
0
        public async Task <IActionResult> Get([FromServices] BookCategoryService service)
        {
            try
            {
                var list = await service.Fetch();

                return(Ok(list));
            }
            catch (HttpResponseException err)
            {
                return(err.ToResponse());
            }
            catch (Exception err)
            {
                return(StatusCode(SERVER_ERROR_CODE, err.Message));
            }
        }
Example #6
0
        public IActionResult TestGet()
        {
            AuthorizationLevelService.Create("Admin");
            AuthorizationLevelService.Create("Librarian");
            AuthorizationLevelService.Create("Client");

            CategoryService.Create("Scifi");
            CategoryService.Create("History");
            CategoryService.Create("Politics");
            CategoryService.Create("Humor");

            AccountService.Create("Von Neumann", "0123456789abcdf", "Admin");
            AccountService.Create("Guthenberg", "1415", "Librarian");
            AccountService.Create("Marilyn Monroe", "12345", "Client");
            AccountService.Create("Elvis Presley", "01114", "Client");
            AccountService.Create("Michael Jackson", "11111", "Client");

            BookService.CreateIfNotExist("Hector Servadac");
            BookCategoryService.Create("Hector Servadac", "Scifi", "Guthenberg");
            BookService.Create("Neuromancer");
            BookCategoryService.Create("Neuromancer", "Scifi", "Guthenberg");
            BookService.Create("Terminator");
            BookCategoryService.Create("Terminator", "Scifi", "Guthenberg");
            BookService.Create("Diplomacy");
            BookCategoryService.Create("Diplomacy", "Politics", "Guthenberg");
            BookService.Create("Before Crisis");
            BookCategoryService.Create("Before Crisis", "History", "Guthenberg");

            BorrowingService.Create("Hector Servadac", "Marilyn Monroe");
            BorrowingService.Create("Terminator", "Marilyn Monroe");
            BorrowingService.Create("Diplomacy", "Michael Jackson");

            var borrowing = BorrowingService.ReadByTitle("Hector Servadac");

            BorrowingService.Delete(borrowing);

            return(View("Login"));
        }
Example #7
0
 public LibraryController(StudentService studentService,
                          CollegeBranchService collegeBranchService,
                          BookService bookService,
                          BookRequestService bookRequestService,
                          UserProfileService userProfileService,
                          DirectoryService directoryService,
                          HistoryService historyService,
                          WebHelper webHelper,
                          LibraryBookService libraryBookService,
                          CategoryService categoryService,
                          BookCategoryService bookCategoryService)
 {
     this._studentService       = studentService;
     this._collegeBranchService = collegeBranchService;
     this._bookService          = bookService;
     this._bookRequestService   = bookRequestService;
     this._userProfileService   = userProfileService;
     this._directoryService     = directoryService;
     this._historyService       = historyService;
     this._webHelper            = webHelper;
     this._libraryBookService   = libraryBookService;
     this._categoryService      = categoryService;
     this._bookCategoryService  = bookCategoryService;
 }
Example #8
0
 public BookCategoryController(BookCategoryService bookCategoryService)
 {
     //this.context = context;
     this.bookCategoryService = bookCategoryService;
 }
 public BookCategoryController(BookCategoryService service)
 {
     _service = service;
 }
Example #10
0
 public BookCategoryController()
 {
     bookCategory = new BookCategoryService();
 }