public async Task <UserDto> GetUserAccordingToUsernameAsync(string username) { using (UnitOfWorkProvider.Create()) { var userLogin = await _userLoginService.GetUserAccordingToUsernameAsync(username); return(await _userService.GetAsync(userLogin.Id)); } }
public async Task <Guid> CreateAuctionWithCategoryNameForUserAsync(AuctionDto auction, string userLogin, string categoryName) { using (var uow = UnitOfWorkProvider.Create()) { auction.CategoryId = (await _categoryService.GetCategoriesIdsAccordingToNameAsync(new[] { categoryName })).FirstOrDefault(); auction.SellerId = (await _userLoginService.GetUserAccordingToUsernameAsync(userLogin)).Id; var auctionId = _auctionService.Create(auction); await uow.Commit(); //var delay = auction.EndTime.Subtract(DateTime.Now); //BackgroundJob.Schedule(() => CloseAuctionDueToTimeoutAsync(auction), delay); //BackgroundJob.Schedule(() => new Func<AuctionDto, Task>(CloseAuctionDueToTimeoutAsync).Invoke(auction), auction.EndTime); return(auctionId); } }