private void detach_tblEnglishes(tblEnglish entity)
		{
			this.SendPropertyChanging();
			entity.tblUser = null;
		}
 partial void DeletetblEnglish(tblEnglish instance);
 partial void UpdatetblEnglish(tblEnglish instance);
 partial void InserttblEnglish(tblEnglish instance);
Exemple #5
0
        /// <summary>
        /// Cập nhật bài viết
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="update"></param>
        /// <returns></returns>
        public static Boolean updateEnglish(int _id, tblEnglish update)
        {
            LTDHDataContext DB = new LTDHDataContext(@strPathDB);

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    var english = DB.tblEnglishes.Single(e => e.ID == _id);

                    english.Title = update.Title;
                    english.Type = update.Type;
                    english.Contents = update.Contents;
                    english.Author = update.Author;
                    english.Posted = update.Posted;
                    english.State = update.State;
                    english.Point = update.Point;
                    english.Tag = update.Tag;

                    DB.SubmitChanges();
                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
Exemple #6
0
        /// <summary>
        /// Thêm một bài viết mới
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        public static Boolean insertEnglish(tblEnglish record)
        {
            LTDHDataContext DB = new LTDHDataContext(@strPathDB);

            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    DB.tblEnglishes.InsertOnSubmit(record);

                    DB.SubmitChanges();

                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }