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)); }
public async Task Create(City city) { city.Id = Guid.NewGuid(); _context.Add(city); await _context.SaveChangesAsync(); }
public void Add <T>(T entity) where T : class { _context.Add(entity); }