public int InsertAttentionIndustry(AttentionIndustry attInd) { AttentionIndustryDataContext db = new AttentionIndustryDataContext(); try { db.AttentionIndustry.InsertOnSubmit(attInd); db.SubmitChanges(); return(int.Parse(attInd.UserID.ToString())); } catch { return(0); } }
public int UpdateAttentionIndustryfoByUserID(AttentionIndustry attInd) { AttentionIndustryDataContext db = new AttentionIndustryDataContext(); try { var result = (from item in db.AttentionIndustry where item.UserID == attInd.UserID select item).Single(); result.IndMark1 = attInd.IndMark1; result.IndMark2 = attInd.IndMark2; result.IndMark3 = attInd.IndMark3; db.SubmitChanges(); return(int.Parse(result.UserID.ToString())); } catch { return(0); } }