예제 #1
0
        /// <summary>
        /// 获取编辑
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static VModel.DictSubject.Form GetEdit(int id)
        {
            dict_subject dbm = GetList().Where(w => w.Id == id).FirstOrDefault();

            return(new VModel.DictSubject.Form
            {
                Id = dbm.Id,
                Name = dbm.Name,
                Sort = dbm.Sort,
                IsEnabled = dbm.IsEnabled
            });
        }
예제 #2
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <returns></returns>
        public static int Edit(VModel.DictSubject.Form m)
        {
            using (var db = new fz_basicEntities())
            {
                dict_subject dbm = db.dict_subject.Find(m.Id);

                dbm.Name      = m.Name;
                dbm.Sort      = m.Sort;
                dbm.IsEnabled = m.IsEnabled;

                db.SaveChanges();
            }

            Common.Caches.RemoveCache("dict_subject");

            return(200);
        }
예제 #3
0
        /// <summary>
        /// 获取名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetName(int?id)
        {
            dict_subject m = GetList().Where(w => w.Id == id).FirstOrDefault();

            return(m == null ? "" : m.Name);
        }