示例#1
0
        public async Task <Customer> Add(Customer customer)
        {
            var entity = _context.Add(customer).Entity;
            await _context.SaveChangesAsync();

            return(entity);
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("LocationId,LocationName")] Location location)
        {
            if (ModelState.IsValid)
            {
                _context.Add(location);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(location));
        }