public IActionResult DeletePoi(int cityId, int id) { if (!mCityRepo.DoesCityExist(cityId)) { return(NotFound(new { CityId = cityId })); } var existingPoi = mCityRepo.GetPoi(cityId, id); if (existingPoi == null) { return(NotFound(new { PoiId = id })); } mCityRepo.DeletePoi(existingPoi); if (!mCityRepo.Save()) { return(StatusCode(500, "Problem occured while saving to the database.")); } mSender.Send("POI deleted", $"POI {existingPoi.Id} '{existingPoi.Name}' was deleted."); return(NoContent()); }
public Task Handle(AddVehicleEvent notification, CancellationToken cancellationToken) { Vehicle vehicle = notification.Vehicle; senderService.Send($"Vehicle {vehicle.Name} was added"); return(Task.CompletedTask); }
public async Task InvokeAsync(HttpContext context) { Trace.WriteLine($"request {context.Request.Method} {context.Request.Path}"); senderService.Send(context.Request.Path); await next.Invoke(context); Trace.WriteLine($"response {context.Response.StatusCode}"); }
public async Task <ActionResult <IEnumerable <Customer> > > Get([FromServices] ISenderService senderService) { var customers = await customerService.GetAsync().ConfigureAwait(false); ISenderService sender = this.HttpContext.RequestServices.GetService(typeof(ISenderService)) as ISenderService; senderService.Send($"Pobrano {customers.Count()} klientów"); return(Ok(customers)); }
public void TestSmtpClient() { SendEmailClient emailClient = new SendEmailClient(_hostname, _hostport, _username, _password, _security); ISenderService senderService = emailClient.ComposeMessage(_from); Mock <IMessageProvider> messageProvideMock = new Mock <IMessageProvider>(); messageProvideMock.Setup(provider => provider.GetText()).Returns("Test text"); messageProvideMock.Setup(provider => provider.GetAbstract()).Returns("Test subject"); Assert.DoesNotThrow(() => senderService.Send(messageProvideMock.Object, _to)); }
public async Task <bool> Handle(SenderCommand request, CancellationToken cancellationToken) { _logger.LogInformation($"Отправка данных [{request.User}]..."); bool result = await _dataBusSenderService.Send(request.User, cancellationToken); if (result) { _logger.LogInformation("Отправка данных завершилась успешно"); } else { _logger.LogInformation("Ошибка отправки данных"); } return(result); }
public Task Handle(AddCustomerEvent notification, CancellationToken cancellationToken) { senderService.Send(notification.Customer); return(Task.CompletedTask); }
public void Send(string receiverString) { _senderService.Send(_messageProvider, receiverString); }