public void RemoveById(int id) { CarWash result = GetCarWashById(id); db.Car_Wash.Remove(result); db.SaveChanges(); }
private void OnCadastrarNew(object sender, EventArgs e) { var carWash = new CarWash(); carWash.Nome = nomeEntry.Text; carWash.CPF = cpfEntry.Text; carWash.Endereço = endereçoEntry.Text; carWash.Email = emailEntry.Text; carWash.Senha = senhaEntry.Text; CarWashDAO dao = new CarWashDAO(); dao.Adicionar(carWash); Navigation.PushAsync(new MainPage(null)); if (string.IsNullOrEmpty(nomeEntry.Text)) { DisplayAlert("Erro", "É necessário digitar um nome", "OK"); Navigation.PushAsync(new CadastroPage(false, null)); return; } if (string.IsNullOrEmpty(cpfEntry.Text)) { DisplayAlert("Erro", "Digite seu CPF", "OK"); Navigation.PushAsync(new CadastroPage(false, null)); return; } if (string.IsNullOrEmpty(emailEntry.Text)) { DisplayAlert("Erro", "É necessário digitar um endereço", "OK"); Navigation.PushAsync(new CadastroPage(false, null)); return; } if (string.IsNullOrEmpty(senhaEntry.Text)) { DisplayAlert("Erro", "É necessário digitar um endereço", "OK"); Navigation.PushAsync(new CadastroPage(false, null)); return; } if (string.IsNullOrEmpty(endereçoEntry.Text)) { DisplayAlert("Erro", "É necessário digitar um endereço", "OK"); Navigation.PushAsync(new CadastroPage(false, null)); return; } }
public CarWashTest() { logger = new FakeLogger(); detailsSource = new FakeDetailsSource(); detailsSerializer = new FakeDetailsSerializer(); detailsPricingFactory = new DetailsPricingFactory(logger); carWash = new CarWash(logger, detailsSource, detailsSerializer, detailsPricingFactory); }
public void AddCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { db.CarWashes.Add(carWash); db.SaveChanges(); } }
public async Task DeleteCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { var result = await Task.FromResult(db.CarWashes.Remove(carWash)); var saved = await Task.FromResult(db.SaveChanges()); } }
public static void A_ChildObjectsCanBeUsedAsBase() { Vehicle tractor = new Tractor(50, 2015, 4); Vehicle bicycle = new Bicycle(30); var washer = new CarWash(); washer.Wash(tractor); washer.Wash(bicycle); }
public CarWashWindow(ProjectDBContext db, CarWash cw = null) { this.cw = cw; if (this.cw == null) { this.cw = new CarWash(); } this.db = db; InitializeComponent(); }
public static void Main(string[] args) { Garage garage = new Garage(); foreach (var car in garage) { CarWash wash = Washer.Wash; wash(car); Console.WriteLine("Car " + car.name + " is " + car.station); } }
public MainPage(CarWash carWash) { InitializeComponent(); if (carWash != null) { this.carWash = carWash; nomeEntry.Text = carWash.Nome; senhaEntry.Text = carWash.Senha; } }
void Delete(int n, System.Collections.IList items) { switch (n) { case 0: Bill[] bills = new Bill[items.Count]; items.CopyTo(bills, 0); db.Bill.RemoveRange(bills); break; case 1: Entry[] entries = new Entry[items.Count]; items.CopyTo(entries, 0); db.Entry.RemoveRange(entries); break; case 2: Product[] products = new Product[items.Count]; items.CopyTo(products, 0); db.Product.RemoveRange(products); break; case 3: Service[] services = new Service[items.Count]; items.CopyTo(services, 0); db.Service.RemoveRange(services); break; case 4: Client[] clients = new Client[items.Count]; items.CopyTo(clients, 0); db.Client.RemoveRange(clients); break; case 5: CarWash[] cws = new CarWash[items.Count]; items.CopyTo(cws, 0); db.CarWash.RemoveRange(cws); break; } try { db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Refresh(n); }
void ChangeEntries(CarWash carWash) { if (carWash == null) { return; } var entries = db.Entry.Where(x => x.Bill == null && x.CarWash == carWash.Id).ToList(); if (bill.Id != 0 && bill.Entry != null && bill.Entry.CarWash == carWash.Id) { entries.Add(bill.Entry); } entry_cb.ItemsSource = entries; }
public CadastroPage(bool isEdit, CarWash carWash) { InitializeComponent(); CadastrarButton.IsVisible = !isEdit; if (carWash != null) { this.carWash = carWash; nomeEntry.Text = carWash.Nome; cpfEntry.Text = carWash.CPF; endereçoEntry.Text = carWash.Endereço; emailEntry.Text = carWash.Email; senhaEntry.Text = carWash.Senha; } }
public async Task SaveCarWash(CarWash carWash) { using (var db = new CarWashBookingDbContext(_context)) { var result = await Task.FromResult(db.CarWashes.Where(w => w.ID == carWash.ID).FirstOrDefault()); if (result != null) { result.Adresse = carWash.Adresse; result.Name = carWash.Name; result.Image = carWash.Image; db.SaveChanges(); } } }
public IActionResult AddCarWash(NewCarWashViewModel carWashModel) { string base64; using (var ms = new MemoryStream()) { carWashModel.UploadFile.CopyTo(ms); var fileBytes = ms.ToArray(); base64 = $"data:image/png;base64,{Convert.ToBase64String(fileBytes)}"; } var carWash = new CarWash { Adresse = carWashModel.Adresse, Image = base64, Name = carWashModel.Name }; _carWashBookingService.AddCarWash(carWash); return(RedirectToAction("Index", "Admin")); }
public CarWashUpdater(CarWash carWash) { _carWash = carWash; }
public void Create(CarWash carWash) { db.Car_Wash.Add(carWash); db.SaveChanges(); }
public void Edit(CarWash carWash) { db.Entry(carWash).State = EntityState.Modified; db.SaveChanges(); }
public IActionResult DeleteCarWash(CarWash carWash) { _carWashBookingService.DeleteCarWash(carWash); return(RedirectToAction("Index", "Admin")); }
public void Adicionar(CarWash carWash) { conexao.Insert(carWash); }
public void Encontrar(CarWash carWash) { conexao.Get <CarWash>(carWash); }
public CarWashController(CarWash carWash) { _carWash = carWash; }