public void Create(SubcontractResponse subContractResponse) { var subContractID = subContractResponse.SubcontractID; if (subContractID <= 0) { return; } var scr = _db.SubcontractResponses.SingleOrDefault(x => x.SubcontractID == subContractID); if (scr != null) { return; } _db.SubcontractResponses.Add(subContractResponse); try { //Check Validation Errors var error = _db.GetValidationErrors(); _db.SaveChanges(); NewlyInsertedID = subContractResponse.ResponseID; } catch (DbEntityValidationException dbEx) { var s = dbEx.Message; } }
public MyResponse(int responseID) { _responseID = responseID; Value = _db.SubcontractResponses.Find(_responseID); }
public MyPurchasingOrder(int subcontractID) { _subcontractID = subcontractID; _response = _db.SubcontractResponses.FirstOrDefault(x => x.SubcontractID == _subcontractID); }