public static void Run([HttpTrigger(AuthorizationLevel.Anonymous, "delete", Route = "Company/{id}")] HttpRequest req, string id, TraceWriter log) { log.Info("C# HTTP trigger function processed DeleteCompany."); if (_dataAccessRead.GetCompany(new Guid(id)) == null) { return; } var companyId = new Guid(id); var cars = _dataAccessRead.GetCars().Where(c => c.CompanyId == companyId); foreach (var car in cars) { var deleteCar = new DeleteCar() { CarId = car.CarId, CompanyId = car.CompanyId, DeleteCarTimeStamp = DateTime.Now.Ticks }; _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false); } var message = new Shared.Messages.Commands.DeleteCompany { DataId = new Guid(), CompanyId = companyId, DeleteCompanyTimeStamp = DateTime.Now.Ticks }; _endpointInstance.Send(Helpers.ServerEndpoint, message).ConfigureAwait(false); }
public async Task DeleteCompany(string id) { if (GetCompany(id) == null) { return; } var companyId = new Guid(id); var cars = _dataAccessRead.GetCars().Where(c => c.CompanyId == companyId); foreach (var car in cars) { var deleteCar = new DeleteCar() { CarId = car.CarId, CompanyId = car.CompanyId, DeleteCarTimeStamp = DateTime.Now.Ticks }; await _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false); } var message = new DeleteCompany { DataId = new Guid(), CompanyId = companyId, DeleteCompanyTimeStamp = DateTime.Now.Ticks }; await _endpointInstance.Send(Helpers.ServerEndpoint, message).ConfigureAwait(false); }
internal EditingContractorForm() { InitializeComponent(); TSB_Censel.Click += (s, e) => Close(); TSB_Save.Click += async(s, e) => await Save?.Invoke(); TSB_AddV.Click += async(s, e) => await AddCar?.Invoke(); TSB_EditV.Click += async(s, e) => await EditCar?.Invoke(); TSB_RemoveV.Click += async(s, e) => await DeleteCar?.Invoke(); TSB_AddCN.Click += async(s, e) => await AddContactPerson?.Invoke(); TSB_EditCN.Click += async(s, e) => await EditContactPerson?.Invoke(); TSB_RemoveCN.Click += async(s, e) => await DeleteContactPerson?.Invoke(); DGV_Cars.MouseDoubleClick += async(s, e) => { if (e.Button == MouseButtons.Left) { await EditCar?.Invoke(); } }; DGV_ContactPersones.MouseDoubleClick += async(s, e) => { if (e.Button == MouseButtons.Left) { await EditContactPerson?.Invoke(); } }; Load += EditingContractorForm_Load; }
public void Delete(DeleteCar request) { var car = _carService.Get(request.Id); if (car == null) { throw HttpError.NotFound($"Invalid CarId"); } _carService.Remove(request.Id); }
public async Task DeleteCar(string id) { var oldCar = GetCar(id); if (oldCar == null) { return; } var deleteCar = new DeleteCar() { CarId = new Guid(id), CompanyId = oldCar.CompanyId, DeleteCarTimeStamp = DateTime.Now.Ticks }; await _endpointInstance.Send(Helpers.ServerEndpoint, deleteCar).ConfigureAwait(false); }
public void GivenTheseExistingCars(Table table) { table.Rows.ForEach(values => { _actor.AttemptsTo(DeleteCar.ByRegistration(values["Registration"])); int customerId = _actor.AsksFor( values.ContainsKey("Customer") ? StoredCustomerId.ForName(values["Customer"]) : StoredCustomerId.First()); _actor.AttemptsTo( InsertCar.WithRegistration(values["Registration"]) .ForCustomer(customerId) .WithMake(values["Make"]) .WithModel(values["Model"])); }); }
public void GivenTheFollowingExistingCar(Table table) { var values = table.Rows.Single(); _actor.AttemptsTo(DeleteCar.WithRegistration(values["Registration"])); int customerId = _actor.AsksFor(StoredCustomerId.ForName(values["Customer"])); _actor.AttemptsTo( InsertCar.WithRegistration(values["Registration"]) .ForCustomer(customerId) .WithMake(values.GetStringOrDefault("Make")) .WithModel(values.GetStringOrDefault("Model")) .MotExpiringOn(values.GetDateOrDefault("MOT Expiry")) .SuppressingMotReminder(values.GetBoolOrDefault("Suppress MOT Reminder"))); _storedCar = _actor.AsksFor(StoredCar.WithRegistration(values["Registration"])); }
public void GivenThereIsNoCarWithRegistration(string registration) { _actor.AttemptsTo(DeleteCar.WithRegistration(registration)); }
public Task <CommandResult> Do(DeleteCar command) { throw new System.NotImplementedException(); }