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 async Task <ActionResult> Create([Bind(Include = "ProvinceId,ProvinceCode,ProvinceName")] Province province) { if (ModelState.IsValid) { db.Provinces.Add(province); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(province)); }
public async Task <ActionResult> Create([Bind(Include = "CityId,Name,Population,ProvinceId")] City city) { if (ModelState.IsValid) { db.Cities.Add(city); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.ProvinceId = new SelectList(db.Provinces, "ProvinceId", "ProvinceCode", city.ProvinceId); return(View(city)); }
public async Task AddLocation(Location location) { _context.Location.Add(location); await _context.SaveChangesAsync(); }