private void OK_Click(object sender, RoutedEventArgs e) { if (salonId != null) { Salons s = new Salons(); s.PostalCode = postalCode.Text.ToString(); s.City = city.Text.ToString(); s.Address = address.Text.ToString(); s.SalonId = salonId; RestService restService = new RestService(WebAddress.Address(), "/salons", token.Token); restService.Put <string, Salons>(salonId, s); salonId = null; } else { Salons s = new Salons(); s.PostalCode = postalCode.Text.ToString(); s.City = city.Text.ToString(); s.Address = address.Text.ToString(); RestService restService = new RestService(WebAddress.Address(), "/salons", token.Token); restService.Post <Salons>(s); } this.Close(); }
public void Create(Salons salon, string name) { var user = db.Users.Include(s => s.Salon).FirstOrDefault(n => n.Email == name); user.Salon.Add(salon); db.SaveChanges(); }
public IActionResult AddNewSalon(Salons salon) { salon.SalonId = Guid.NewGuid().ToString(); salonsLogic.InsertSalon(salon); return(RedirectToAction(nameof(ListSalons))); }
public IActionResult DeleteSalon(string id) { Salons s = salonsLogic.GetOneSalon(id); salonsLogic.DeleteSalon(id); return(RedirectToAction(nameof(ListSalons))); }
public AddSalonWindow(Salons s, TokenVM _token) { InitializeComponent(); this.postalCode.Text = s.PostalCode; this.city.Text = s.City; this.address.Text = s.Address; salonId = s.SalonId; token = _token; }
public IActionResult Edit(Salons salons, int id) { if (ModelState.IsValid) { salonSvc.Edit(salons, id); return(RedirectToAction(nameof(All))); } return(View()); }
public IActionResult Create(Salons salon) { if (ModelState.IsValid) { var userName = HttpContext.User.Identity.Name; this.salonSvc.Create(salon, userName); return(RedirectToAction(nameof(All))); } return(View(salon)); }
void LoadData() { Salons.Add(new Salon { Id = 1, Client = "Cameron Jones", SalonName = "Super Cut Salon", Ranking = "4.8", Img = "user01.png", BgColor = "#FFF0EB" }); Salons.Add(new Salon { Id = 2, Client = "Max Robertson", SalonName = "Rossano Ferretti Salon", Ranking = "4.7", Img = "user02.png", BgColor = "#EBF6FF" }); Salons.Add(new Salon { Id = 3, Client = "Beth Watson", SalonName = "Neville Hair and Beauty", Ranking = "4.6", Img = "user03.png", BgColor = "#FFF0EB" }); }
public void TestAddSalon() { Mock <IRepository <Salons> > salonRepo = new Mock <IRepository <Salons> >(); Salons salon = new Salons() { City = "Budapest", PostalCode = "1132", Address = "Nemtudom utca 12." }; salonRepo.Setup(repo => repo.Insert(It.IsAny <Salons>())); SalonsLogic logic = new SalonsLogic(salonRepo.Object); logic.InsertSalon(salon); salonRepo.Verify(repo => repo.Insert(salon), Times.Once); }
public void Edit(Salons salon, int id) { try { var salonFromDb = this.db.Salons.FirstOrDefault(s => s.Id == id); salonFromDb.Name = salon.Name; salonFromDb.City = salon.City; salonFromDb.Country = salon.Country; salon.Products = salon.Products; db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { Console.WriteLine("Ne vlizai tuk"); } }
public void TestUpdatingSalon() { Mock <IRepository <Salons> > salonRepo = new Mock <IRepository <Salons> >(); Salons salon = new Salons() { SalonId = Guid.NewGuid().ToString(), City = "Sopron", Address = "Zrínyi Miklós u. 32", PostalCode = "9400" }; salonRepo.Setup(repo => repo.Update(It.IsAny <string>(), It.IsAny <Salons>())); SalonsLogic logic = new SalonsLogic(salonRepo.Object); logic.UpdateSalon(salon.SalonId, salon); salonRepo.Verify(repo => repo.Update(salon.SalonId, salon), Times.Once); }
public void UpdateSalon(string salonid, Salons salon) { salonrepo.Update(salonid, salon); }
public IActionResult GenerateDB() { /*Salons *************************************/ Salons s = new Salons { SalonId = Guid.NewGuid().ToString(), City = "Budapest", Address = "Liszt Ferenc International Airport Terminal 2", PostalCode = "2200" }; Salons s1 = new Salons { SalonId = Guid.NewGuid().ToString(), City = "Budapest", Address = "Lövőház u. 2", PostalCode = "1024" }; Salons s2 = new Salons { SalonId = Guid.NewGuid().ToString(), City = "Budapest", Address = "Arany János u. 26-28", PostalCode = "1051" }; Salons s3 = new Salons { SalonId = Guid.NewGuid().ToString(), City = "Győr", Address = "Puskás Tivadar u. 9", PostalCode = "9027" }; Salons s4 = new Salons { SalonId = Guid.NewGuid().ToString(), City = "Sopron", Address = "Zrínyi Miklós u. 32", PostalCode = "9400" }; /*Cars ***************************************/ Cars c = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Audi", Model = "A6", ModelYear = 2019, BodyType = "Sedan", CombFuelEco = 9.4, Available = false, PricePerDay = 102100, SalonId = s2.SalonId }; Cars c1 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Audi", Model = "A4", ModelYear = 2018, BodyType = "Wagon", CombFuelEco = 7.5, Available = true, PricePerDay = 85397, SalonId = s2.SalonId }; Cars c2 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Audi", Model = "A1", ModelYear = 2020, BodyType = "Hatchback", CombFuelEco = 4.7, Available = true, PricePerDay = 34972, SalonId = s3.SalonId }; Cars c3 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Audi", Model = "A3", ModelYear = 2020, BodyType = "Hatchback", CombFuelEco = 7.8, Available = true, PricePerDay = 41567, SalonId = s.SalonId }; Cars c4 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Toyota", Model = "C-HR", ModelYear = 2018, BodyType = "SUV", CombFuelEco = 8.1, Available = false, PricePerDay = 30537, SalonId = s.SalonId }; Cars c5 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Volkswagen", Model = "Transporter", ModelYear = 2017, BodyType = "Van", CombFuelEco = 7.5, Available = false, PricePerDay = 53481, SalonId = s1.SalonId }; Cars c6 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Nissan", Model = "GT-R", ModelYear = 2020, BodyType = "Coupe", CombFuelEco = 13, Available = true, PricePerDay = 368798, SalonId = s2.SalonId }; Cars c7 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Nissan", Model = "300ZX", ModelYear = 2000, BodyType = "Coupe", CombFuelEco = 13, Available = false, PricePerDay = 198375, SalonId = s2.SalonId }; Cars c8 = new Cars { CarId = Guid.NewGuid().ToString(), Make = "Mitsubishi", Model = "Lancer Evolution VIII MR", ModelYear = 2005, BodyType = "Sedan", CombFuelEco = 10.9, Available = false, PricePerDay = 296378, SalonId = s2.SalonId }; /*Renters ************************************/ Renters r = new Renters { RenterId = Guid.NewGuid().ToString(), Name = "Kiss Gabor", PostalCode = "4034", City = "Debrecen", Address = "Elso utca 1.", Email = "*****@*****.**", PhoneNumber = "+31 880 308 7288", RentedDays = 11, CarId = c.CarId }; Renters r1 = new Renters { RenterId = Guid.NewGuid().ToString(), Name = "Nagy Aron", PostalCode = "1111", City = "Budapest", Address = "Masodik utca 2.", Email = "*****@*****.**", PhoneNumber = "+46 697 322 8112", RentedDays = 4, CarId = c4.CarId }; Renters r2 = new Renters { RenterId = Guid.NewGuid().ToString(), Name = "Toth Eszter", PostalCode = "1020", City = "Bécs", Address = "Harmadik utca 3.", Email = "*****@*****.**", PhoneNumber = "+86 918 333 5232", RentedDays = 21, CarId = c5.CarId }; Renters r3 = new Renters { RenterId = Guid.NewGuid().ToString(), Name = "Jerrome Wrightem", PostalCode = "90019", City = "Los Angeles", Address = "80 Havey Alley", Email = "*****@*****.**", PhoneNumber = "+86 619 977 2794", RentedDays = 30, CarId = c7.CarId }; Renters r4 = new Renters { RenterId = Guid.NewGuid().ToString(), Name = "Lakatos Brendon", PostalCode = "9028", City = "Győr", Address = "Negyedik utca 4.", Email = "*****@*****.**", PhoneNumber = "+51 442 752 0329", RentedDays = 4, CarId = c8.CarId }; salonsLogic.InsertSalon(s); salonsLogic.InsertSalon(s1); salonsLogic.InsertSalon(s2); salonsLogic.InsertSalon(s3); salonsLogic.InsertSalon(s4); carsLogic.InsertCar(c); carsLogic.InsertCar(c1); carsLogic.InsertCar(c2); carsLogic.InsertCar(c3); carsLogic.InsertCar(c4); carsLogic.InsertCar(c5); carsLogic.InsertCar(c6); carsLogic.InsertCar(c7); carsLogic.InsertCar(c8); rentersLogic.InsertRenter(r); rentersLogic.InsertRenter(r1); rentersLogic.InsertRenter(r2); rentersLogic.InsertRenter(r3); rentersLogic.InsertRenter(r4); return(RedirectToAction(nameof(Index))); }
public IActionResult EditSalon(Salons s) { salonsLogic.UpdateSalon(s.SalonId, s); return(RedirectToAction(nameof(ListSalons))); }
public AddCarWindow(Salons s, TokenVM _token) { InitializeComponent(); this.salonId = s.SalonId; token = _token; }
public void InsertSalon([FromBody] Salons salon) { salon.SalonId = Guid.NewGuid().ToString(); sLogic.InsertSalon(salon); }
public void UpdateSalon(string salonid, [FromBody] Salons salon) { sLogic.UpdateSalon(salonid, salon); }
public void InsertSalon(Salons salon) { salonrepo.Insert(salon); }