public int DeleteIndustryByIndID(int indID) { int count = 0; industryDataContext db = new industryDataContext(); var user = from c in db.industry where c.IndID == indID select c; if (user.Count() > 0) { db.industry.DeleteAllOnSubmit(user); count = db.industry.Where(c => c.IndID == indID).Count(); } return(count); }
public industry GetIndustry(int indID) { industryDataContext db = new industryDataContext(); if (db.industry.Count() > 0) { var user = db.industry.Single(c => c.IndID == indID); return(user); } else { return(null); } }
public IList <industry> GetIndustry() { industryDataContext db = new industryDataContext(); IEnumerable <industry> attInd = from c in db.industry select c; if (attInd != null) { return(attInd.ToList <industry>()); } else { return(new List <industry>()); } }
public int InsertIndustry(industry ind) { industryDataContext db = new industryDataContext(); try { db.industry.InsertOnSubmit(ind); db.SubmitChanges(); return(int.Parse(ind.IndID.ToString())); } catch { return(0); } }
public int UpdateIndustryfoByIndID(industry ind) { industryDataContext db = new industryDataContext(); try { var result = (from item in db.industry where item.IndID == ind.IndID select item).Single(); result.IndName = ind.IndName; result.IndChildID = ind.IndChildID; result.IndChildName = ind.IndChildName; db.SubmitChanges(); return(int.Parse(result.IndID.ToString())); } catch { return(0); } }