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));
        }
Beispiel #2
0
        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));
        }
Beispiel #4
0
        public virtual async Task <int> SaveChangeAsync()
        {
            int result = 0;

            try
            {
                result = await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                //TODO: write log here
            }
            return(result);
        }
Beispiel #5
0
 public Task <int> SaveChangesAsync()
 {
     return(_context.SaveChangesAsync());
 }