private void FixupCustomerConstruct(CustomerConstruct previousValue) { if (previousValue != null && ReferenceEquals(previousValue.CustomerProject, this)) { previousValue.CustomerProject = null; } if (CustomerConstruct != null) { CustomerConstruct.CustomerProject = this; } }
public virtual ActionResult SaveConstructinfo(int prjid, CustConstructModel tosave) { if (ModelState.IsValid) { var custconstruct = Repository.SingleOrDefault<CustomerConstruct>(x => x.CustomerProjectID == prjid); if (custconstruct == null) { custconstruct = new CustomerConstruct {CustomerProjectID = prjid}; TryUpdateModel(custconstruct); Repository.Add(custconstruct); Repository.Save(); return null; } TryUpdateModel(custconstruct); Repository.Save(); return null; } return Content("出错了"); }