Beispiel #1
0
        public ActionResult RoleUpdate(Role model)
        {
            var role = UserBLL.GetRoleById(model.Id);
            if (null != role)
            {
                role.CName = model.CName;
                role.EName = model.EName;
                role.SCode = model.SCode;
                role.UpdateTime = DateTime.Now;

                UserBLL.UpdateRole(role);
            }

            return RoleList();
        }
Beispiel #2
0
        /// <summary>
        /// 作者:Vincen
        /// 时间:2014.04.15
        /// 描述:更新角色
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool UpdateRole(Role model)
        {
            using (var edb = new EmeEntities())
            {
                var role = edb.Role.FirstOrDefault(p => p.Id == model.Id);
                if (null == role)
                    return false;

                role.CName = model.CName;
                role.EName = model.EName;
                role.SCode = model.SCode;
                role.Status = model.Status;
                role.UpdateBy = model.UpdateBy;
                role.UpdateTime = DateTime.Now;
                role.Remark = model.Remark;

                edb.Entry(role).State = EntityState.Modified;
                return edb.SaveChanges() > 0;
            }
        }
Beispiel #3
0
        public ActionResult RoleCreate(Role model)
        {
            var role = new Role()
            {
                CName = model.CName,
                EName = model.EName,
                SCode = model.SCode,
                Status = Utility.CommonHelper.To<int>(Enum.StatusType.Active),
                CreateTime = DateTime.Now
            };

            UserBLL.CreateRole(role);

            return RoleList();
        }
Beispiel #4
0
 /// <summary>
 /// 作者:Vincen
 /// 时间:2014.04.15
 /// 描述:创建角色
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static bool CreateRole(Role model)
 {
     using (var edb = new EmeEntities())
     {
         edb.Entry(model).State = EntityState.Added;
         return edb.SaveChanges() > 0;
     }
 }