public void Create(Bestellijn entity) { using (var db = new VoetbalContext()) { db.Entry(entity).State = EntityState.Added; db.SaveChanges(); } }
public async System.Threading.Tasks.Task <ActionResult> Winkelmandje(WinkelmandViewModel vm) { IList <Winkelmandlijn> lines = new List <Winkelmandlijn>(); for (int i = 0; i < vm.winkelmandlineIDS.Count(); i++) { lines.Add(winkservice.getLineByID(vm.winkelmandlineIDS[i])); } for (int i = 0; i < lines.Count(); i++) { } Bestelling bestelling = new Bestelling(); bestelling.gebruikerID = User.Identity.GetUserId(); bestelling.date = DateTime.Today.Date; bestelling = bservice.Create(bestelling); IdentityMessage msg = new IdentityMessage(); msg.Subject = "Uw bestelling"; msg.Destination = gservice.getGebruikerByID(User.Identity.GetUserId()).email; string content = "<h4>Uw bestelling</h4><p>Hieronder vindt u een overzicht van uw bestelling:</p><table style='text-align:center;'><thead style='background:#333;color:#fff;'><tr><td>Type</td><td>Wedstrijd</td><td>Prijs</td><td>Plaats</td></tr></thead><tbody>"; for (int i = 0; i < lines.Count(); i++) { Bestellijn line = new Bestellijn(); if (lines.ElementAt(i).AboID == null) { line.ticketID = lines.ElementAt(i).TicketID; Ticket t = tservice.getTicketByID(line.ticketID.Value); Wedstrijd w = wservice.getWedstrijdByID(t.wedstrijdID); Ploeg thuis = plservice.getPloegByID(w.thuisID); Ploeg uit = plservice.getPloegByID(w.uitID); line.bestellingID = bestelling.BestellingID; Prijs p = prservice.getPriceByID(t.PrijsID); Plaats pl = pservice.getPlaatsByID(p.plaatsID); content += "<tr><td>Ticket</td><td>" + thuis.naam + " - " + uit.naam + "</td><td>" + p.prijs + ",00</td><td>" + pl.plaatsNaam + "</td></tr>"; } else { line.aboID = lines.ElementAt(i).AboID; Abo a = aservice.getAboByID(line.aboID.Value); line.bestellingID = bestelling.BestellingID; Plaats pl = pservice.getPlaatsByID(a.plaatsID); Ploeg ploeg = plservice.getPloegByID(a.ploegID); content += "<tr><td>Abonnement</td><td>" + ploeg.naam + "</td><td>" + a.prijs + ",00</td><td>" + pl.plaatsNaam + "</td></tr>"; } blservice.Create(line); } content += "</tbody></table>"; winkservice.DeleteLinesFromUser(User.Identity.GetUserId()); msg.Body = content; EmailService service = new EmailService(); await service.SendAsync(msg); return(RedirectToAction("OrderBevestiging", "Home")); }
//Sla bestellijn op. public void saveBestellijn(Bestellijn _bestellijn) { MySqlConnection sqlConn = new MySqlConnection(ConnStr); sqlConn.Open(); string query = "insert into tblbestellijn (OrderNr,ArtNr,Aantal,prijs) values (" + _bestellijn.OrderNr + "," + _bestellijn.ArtNr + "," + _bestellijn.Aantal + "," + _bestellijn.Prijs.ToString().Replace(',', '.') + ")"; MySqlCommand sqlCmd = new MySqlCommand(query, sqlConn); sqlCmd.ExecuteNonQuery(); sqlConn.Close(); }
public void insertOrderline(Bestellijn orderl) { MySqlConnection conn = new MySqlConnection(ConnStr); conn.Open(); string JuistePrijs = orderl.HistPrijs.ToString().Replace(",", "."); string qry = "insert into tblbestellijn(OrderNr, ArtikelNr, Aantal, HistPrijs) values ('" + orderl.OrderNr + "','" + orderl.ArtikelNr + "','" + orderl.Aantal + "','"+JuistePrijs+"')"; MySqlCommand cmd = new MySqlCommand(qry, conn); cmd.ExecuteNonQuery(); conn.Close(); }
public void Create(Bestellijn entity) { bestellijnDAO.Create(entity); }
public void Update(Bestellijn entity) { bestellijnDAO.Update(entity); }