public BookController( [FromServices] IUnitOfWork uow, [FromServices] IMapper mapper, [FromServices] ILibraryBook libraryBookMananger, [FromServices] IBook bookMananger, [FromServices] IContact contactMananger, [FromServices] ILibrary libraryMananger, [FromServices] IType typeMananger, [FromServices] IHttpContextAccessor httpContextAccessor, [FromServices] IUser userMananger, [FromServices] IAuthor authorMananger, [FromServices] ICategory categoryMananger ) { _uow = uow; _mapper = mapper; _libraryBookMananger = libraryBookMananger; _bookMananger = bookMananger; _contactMananger = contactMananger; _libraryMananger = libraryMananger; _typeMananger = typeMananger; _httpContext = httpContextAccessor.HttpContext; _userMananger = userMananger; _authorMananger = authorMananger; _categoryMananger = categoryMananger; }
public ContactController( [FromServices] IUnitOfWork uow, [FromServices] IMapper mapper, [FromServices] IHttpContextAccessor httpContextAccessor, [FromServices] ILibraryBook libraryBookMananger, [FromServices] IContact contactMananger, [FromServices] INotification notificationMananger, [FromServices] INotificationPerson notificationPersonMananger, [FromServices] IUser userMananger ) { _uow = uow; _mapper = mapper; _httpContext = httpContextAccessor.HttpContext; _libraryBookMananger = libraryBookMananger; _contactMananger = contactMananger; _notificationMananger = notificationMananger; _notificationPersonMananger = notificationPersonMananger; _userMananger = userMananger; }
public IActionResult CheckoutALibraryBook(Guid bookId) { ILibraryBook book = _libraryService.Book(bookId); string message = string.Empty; if (book != null) { DateTime dueDate = DateTime.Now.AddDays(30); CheckoutResult result = book.Checkout(); if (result.CheckedOutResultStatus == CheckedOutResultStatus.Ok) { return(Ok(new { BookId = bookId, DueDate = dueDate })); } message = result.Message; } return(BadRequest(message)); }