public void SubmitOrder(string name, string lastname, string phoneNumber, int?location) { // LINQ: First fails by throwing exception, // FirstOrDefault fails to just null var useradd = new Users { FirstName = name, LastName = lastname, PhoneNumber = phoneNumber, DefaultLocationFk = location }; _db.Add(useradd); _db.SaveChanges(); }
public void InsertLoc(string loc, int doug, int cheese, int pepperoni, int sausage, int bacon, int onion, int chiken, int sauce, int chorizo) { var locat = new Locations { Locations1 = loc, Doug = doug, Cheese = cheese, Pepperoni = pepperoni, Sausage = sausage, Bacon = bacon, Onion = onion, Chiken = chiken, Sauce = sauce, Chorizo = chorizo }; _db.Add(locat); _db.SaveChanges(); }
public async Task <IActionResult> Create([Bind("LocationsId,Locations1,Doug,Cheese,Pepperoni,Sausage,Bacon,Onion,Chiken,Sauce,Chorizo")] Locations locations) { if (ModelState.IsValid) { _context.Add(locations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(locations)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,PhoneNumber,DefaultLocationFk")] Users users) { if (ModelState.IsValid) { _context.Add(users); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DefaultLocationFk"] = new SelectList(_context.Locations, "LocationsId", "LocationsId", users.DefaultLocationFk); return(View(users)); }
public async Task <IActionResult> Create([Bind("PizzaId,Pizza1,Size,Cost,OrdersIdfk,Doug,Cheese,Pepperoni,Sausage,Bacon,Onion,Chiken,Sauce,Chorizo")] Pizza pizza) { if (ModelState.IsValid) { _context.Add(pizza); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrdersIdfk"] = new SelectList(_context.Orders, "OrderId", "OrderId", pizza.OrdersIdfk); return(View(pizza)); }
public async Task <IActionResult> Create([Bind("OrderId,UserIdfk,LocationsIdfk,DateTimeOrder")] Orders orders) { if (ModelState.IsValid) { _context.Add(orders); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LocationsIdfk"] = new SelectList(_context.Locations, "LocationsId", "LocationsId", orders.LocationsIdfk); ViewData["UserIdfk"] = new SelectList(_context.Users, "Id", "Id", orders.UserIdfk); return(View(orders)); }