public async Task <BookModel> Return(Guid bookId, string userId, string url) { ActiveHolderModel holder = new ActiveHolderModel() { BookId = bookId, UserId = userId, DateOfReceipt = DateTime.Now }; StatusLogModel newLog = new StatusLogModel() { BookId = bookId, UserId = userId, Date = DateTime.Now, Operation = Operations.Returned }; await _holdersService.Delete(holder); await _statusLogService.Create(newLog); var result = _bookService.ReturnBook(bookId); var listNotification = _notificationService.GetList(bookId); foreach (var notification in listNotification) { var user = _userService.GetUserById(notification.UserId); var book = _bookService.GetBook(bookId); var bookCardURL = url.Replace("UpdateBook", $"BookCard?bookId={book.Id}"); await _requestClient.Create(new { MailTo = user.Email, Subject = "Интересующая Вас книга появилась в наличии Библиотеки ММТР", Body = $"Уважаемый(ая) {user.SecondName} {user.FirstName}, книга {book.Title} {book.Author} появилась в библиотеке ММТР. Вы можете взять её по ссылке {bookCardURL}" }).GetResponse <IMailSent>(); await _notificationService.Delete(notification); } return(result); }