public ActionResult Create(string zipcode) { var zip = DbUtil.Db.Zips.SingleOrDefault(mz => mz.ZipCode == zipcode); if (zip != null) return Content(Util.EndShowMessage("Zipcode already exists", "/MetroZips", "Go back")); var m = new Zip { ZipCode = zipcode }; DbUtil.Db.Zips.InsertOnSubmit(m); DbUtil.Db.SubmitChanges(); return Redirect("/MetroZips/"); }
public ActionResult Create(string zipcode) { var zip = DbUtil.Db.Zips.SingleOrDefault(mz => mz.ZipCode == zipcode); if (zip == null) { var m = new Zip { ZipCode = zipcode }; DbUtil.Db.Zips.InsertOnSubmit(m); DbUtil.Db.SubmitChanges(); } return Redirect($"/MetroZips/#{zipcode}"); }
private void detach_Zips(Zip entity) { this.SendPropertyChanging(); entity.ResidentCode = null; }
private void attach_Zips(Zip entity) { this.SendPropertyChanging(); entity.ResidentCode = this; }