public async Task <ActionResult> Edit( [Bind(Include = "FloodKillingId,CountryId,Amount,Year")] FloodKilling floodKilling) { if (ModelState.IsValid) { db.Entry(floodKilling).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "Name", floodKilling.CountryId); return(View(floodKilling)); }
public async Task <ActionResult> Create( [Bind(Include = "FloodKillingId,CountryId,Amount,Year")] FloodKilling floodKilling) { if (ModelState.IsValid) { floodKilling.FloodKillingId = Guid.NewGuid(); db.FloodKillings.Add(floodKilling); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "Name", floodKilling.CountryId); return(View(floodKilling)); }