public async Task <IActionResult> Create([Bind("Name,Storenum")] Location location) { if (ModelState.IsValid) { _context.Add(location); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Create([Bind("Name,Address,Storenum,Phone")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Storenum"] = new SelectList(_context.Location, "Storenum", "Name", customer.Storenum); return(View(customer)); }
public async Task <IActionResult> Create([Bind("Name,Ordernum,Ordertime")] FoodOrder foodOrder) { if (ModelState.IsValid) { _context.Add(foodOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Name"] = new SelectList(_context.Customer, "Name", "Name", foodOrder.Name); return(View(foodOrder)); }
public virtual async Task <int> SaveChangeAsync() { int result = 0; try { result = await _context.SaveChangesAsync(); } catch (Exception ex) { //TODO: write log here } return(result); }
public Task <int> SaveChangesAsync() { return(_context.SaveChangesAsync()); }