public bool AddCriminal(CriminalInfoTable criminalInfo) { try { context.CriminalInfoTables.InsertOnSubmit(criminalInfo); context.SubmitChanges(); return(true); } catch { return(false); } }
public static CriminalInfoTable ConvertCriminalCriminalInfo(CriminalInfo criminalInfoBean) { if (criminalInfoBean == null) { return(null); } CriminalInfoTable criminalInfoDB = new CriminalInfoTable() { Id = criminalInfoBean.Id, Name = criminalInfoBean.Name, Age = criminalInfoBean.Age, Gender = criminalInfoBean.Gender, Height = (float)criminalInfoBean.Height, Nationality = criminalInfoBean.Nationality, Weight = (float)criminalInfoBean.Weight, }; return(criminalInfoDB); }
public bool UpdateCriminal(CriminalInfoTable criminal) { try { CriminalInfoTable selectedCriminal = (from r in context.CriminalInfoTables where r.Id.Equals(criminal.Id) select r).First(); selectedCriminal.Name = criminal.Name; selectedCriminal.Nationality = criminal.Nationality; selectedCriminal.Height = criminal.Height; selectedCriminal.Weight = criminal.Weight; selectedCriminal.Age = criminal.Age; selectedCriminal.Gender = criminal.Gender; context.SubmitChanges(); return(true); } catch { return(false); } }
public bool DeleteCriminal(long id) { try { CriminalInfoTable obj = (from r in context.CriminalInfoTables where r.Id.Equals(id) select r).First(); if (obj != null) { context.CriminalInfoTables.DeleteOnSubmit(obj); context.SubmitChanges(); return(true); } else { return(false); } } catch { return(false); } }
partial void DeleteCriminalInfoTable(CriminalInfoTable instance);
partial void UpdateCriminalInfoTable(CriminalInfoTable instance);
partial void InsertCriminalInfoTable(CriminalInfoTable instance);