public static AdjusterHandleClaimType Save(AdjusterHandleClaimType handleClaimType) { if (handleClaimType.ID == 0) { DbContextHelper.DbContext.Add(handleClaimType); } DbContextHelper.DbContext.SaveChanges(); return(handleClaimType); }
public static void Delete(int id) { // Create an entity to represent the Entity you wish to delete // Notice you don't need to know all the properties, in this // case just the ID will do. AdjusterHandleClaimType handleClaimType = new AdjusterHandleClaimType { ID = id }; // Now attach the category stub object to the "Categories" set. // This puts the Entity into the context in the unchanged state, // This is same state it would have had if you made the query DbContextHelper.DbContext.AttachTo("AdjusterHandleClaimTypes", handleClaimType); // Do the delete the category DbContextHelper.DbContext.DeleteObject(handleClaimType); // Apply the delete to the database DbContextHelper.DbContext.SaveChanges(); }
protected void ddlPolicyType_SelectedIndexChanged(object sender, EventArgs e) { AdjusterHandleClaimType claimHandle = null; int adjusterID = Convert.ToInt32(hdId.Value); int policyTypeID = Convert.ToInt32(ddlPolicyType.SelectedValue); if (policyTypeID > 0) { claimHandle = new AdjusterHandleClaimType(); claimHandle.AdjusterID = adjusterID; claimHandle.PolicyTypeID = policyTypeID; AdjusterTypeClaimHandledManager.Save(claimHandle); ddlPolicyType.SelectedIndex = -1; bindClaimTypeHandled(); } }