public async Task <ActionResult> Edit([Bind(Include = "Id,CountryName,IsoCode,PhoneCode")] CountryViewModel mod) { try { if (ModelState.IsValid) { var country = CauntryRelase.EditCountry(mod); db.Entry(country).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(mod)); } catch { return(RedirectToAction("Index")); } }
public async Task <ActionResult> Edit(int?id) { try { if (id == null) { //return new HttpStatusCodeResult(HttpStatusCode.BadRequest); return(PartialView("PartialNotFound", id.ToString())); } CountryPublished countryPublished = await db.CountryPublisheds.FindAsync(id); if (countryPublished == null) { //return HttpNotFound(); return(PartialView("PartialNotFound", id.ToString())); } var model = CauntryRelase.EditCountry(countryPublished); return(View(model)); } catch { return(RedirectToAction("Index")); } }