Exemple #1
0
        public JsonResult Add(Role role)
        {
            var entity = new Role()
            {
                RoleName = role.RoleName,
                Remark = role.Remark,
                Enabled = role.Enabled,
                SortCode = role.SortCode,
                CreateUserId = SessionUser.Data.Id,
                CreateUserName = SessionUser.Data.UserName,
                CreateDate = DateTime.Now
            };

            var response = service.Add(new Qz.Core.Entity.Request<Role>
            {
                Obj = entity
            });

            return Json(response);
        }
Exemple #2
0
        public JsonResult Modify(Role role)
        {
            var response = new Qz.Core.Entity.Response<Role>();

            if (role == null || role.Id <= 0)
            {
                response.Status = 1;
                response.Message = "角色Id 为 0或不存在 !";
                return Json(response);
            }

            var entity = service.GetById(role.Id);
            if (entity.Status != 0)
            {
                response.Status = entity.Status;
                response.Message = entity.Message;
                return Json(response);
            }

            entity.Data.RoleName = role.RoleName;
            entity.Data.Remark = role.Remark;
            entity.Data.SortCode = role.SortCode;
            entity.Data.Enabled = role.Enabled;
            entity.Data.ModifyDate = DateTime.Now ;
            entity.Data.ModifyUserId = SessionUser.Data.Id;
            entity.Data.ModifyUserName = SessionUser.Data.UserName;

            response = service.Modify(new Qz.Core.Entity.Request<Role>()
            {
                Obj = entity.Data
            });

            return Json(response);
        }