public ActionResult Create(БанкАдрес model) { if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } bankRepository.saveBank(model.банк); return(Redirect("/Bank/Show")); }
public ActionResult Update(БанкАдрес model) { if (!ModelState.IsValid) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } model.банк.ИД_Адреса = model.адрес.ИД_Адреса; bankRepository.update(model); return(Redirect("/Bank/Show")); }
public ActionResult Update(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Банк банк = bankRepository.findBankById(id.Value); БанкАдрес банкАдрес = new БанкАдрес(); банкАдрес.банк = банк; банкАдрес.адрес = банк.Адрес; return(View(банкАдрес)); }
public void update(БанкАдрес банкАдрес) { dBModel.Entry(банкАдрес.адрес).State = EntityState.Modified; dBModel.Entry(банкАдрес.банк).State = EntityState.Modified; try { dBModel.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (DbEntityValidationResult validationError in ex.EntityValidationErrors) { Trace.Write("Object: " + validationError.Entry.Entity.ToString()); Trace.Write(""); foreach (DbValidationError err in validationError.ValidationErrors) { Trace.Write(err.ErrorMessage + ""); } } } }
public ActionResult Create() { БанкАдрес банкАдрес = new БанкАдрес(); return(View(банкАдрес)); }