public async Task <IActionResult> Create([Bind("Id,LocationName")] Locations locations) { if (ModelState.IsValid) { _context.Add(locations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(locations)); }
public void Add(Location location) { context.Add(location); context.SaveChanges(); }