Exemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("city_id,country_id,region_id,name")] City city)
        {
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(city));
        }
Exemplo n.º 2
0
 public async Task Create(City city)
 {
     city.Id = Guid.NewGuid();
     _context.Add(city);
     await _context.SaveChangesAsync();
 }
Exemplo n.º 3
0
 public void Add <T>(T entity) where T : class
 {
     _context.Add(entity);
 }