public async Task <ActionResult> DeleteConfirmed(int id) { CityOfResidenceModel cityOfResidenceModel = await db.CityOfResidenceModel.FindAsync(id); db.CityOfResidenceModel.Remove(cityOfResidenceModel); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "CityOfResidenceId,CityOfResidence")] CityOfResidenceModel cityOfResidenceModel) { if (ModelState.IsValid) { db.Entry(cityOfResidenceModel).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cityOfResidenceModel)); }
public async Task <ActionResult> Create([Bind(Include = "CityOfResidenceId,CityOfResidence")] CityOfResidenceModel cityOfResidenceModel) { if (ModelState.IsValid) { db.CityOfResidenceModel.Add(cityOfResidenceModel); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cityOfResidenceModel)); }
// GET: CityOfResidenceModels/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CityOfResidenceModel cityOfResidenceModel = await db.CityOfResidenceModel.FindAsync(id); if (cityOfResidenceModel == null) { return(HttpNotFound()); } return(View(cityOfResidenceModel)); }