public static bool InsertItSupport(string sname, string sphone, out string errmsg) { bool bOk = false; using (FavLinkEntities context = new FavLinkEntities()) { var items = from x in context.tbl_itsupport where 0 == x.name.CompareTo(sname) select x; if (items.Any()) { errmsg = string.Format("{0} already exist", sname); return(false); } //insert var entity = new tbl_itsupport() { name = sname, phone_number = sphone }; try { context.tbl_itsupport.AddObject(entity); context.SaveChanges(); bOk = true; errmsg = string.Empty; } catch (Exception ex) { errmsg = ex.Message; } } return(bOk); }
/// <summary> /// Create a new tbl_itsupport object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> public static tbl_itsupport Createtbl_itsupport(global::System.Int32 id, global::System.String name) { tbl_itsupport tbl_itsupport = new tbl_itsupport(); tbl_itsupport.id = id; tbl_itsupport.name = name; return(tbl_itsupport); }
/// <summary> /// Deprecated Method for adding a new object to the tbl_itsupport EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTotbl_itsupport(tbl_itsupport tbl_itsupport) { base.AddObject("tbl_itsupport", tbl_itsupport); }