示例#1
0
        public ActionResult Update(RoleItemModel roleItemModel)
        {
            try
            {
                if (IsUpdate(roleItemModel.OperationResult))
                {
                    if (IsValid(roleItemModel.OperationResult, roleItemModel.Role))
                    {
                        Role role = (Role)roleItemModel.Role.ToData();
                        if (Application.Update(roleItemModel.OperationResult, role))
                        {
                            if (roleItemModel.IsSave)
                            {
                                return(JsonResultSuccess(roleItemModel.OperationResult,
                                                         Url.Action("Update", "Role", new { Id = role.Id }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(roleItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                roleItemModel.OperationResult.ParseException(exception);
            }

            roleItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(roleItemModel.OperationResult));
        }
示例#2
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            RoleItemModel roleItemModel = new RoleItemModel(ActivityOperations, "Create", masterEntity, masterKey);

            try
            {
                if (IsCreate(roleItemModel.OperationResult))
                {
                    return(ZPartialView("CRUD", roleItemModel));
                }
            }
            catch (Exception exception)
            {
                roleItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(roleItemModel.OperationResult));
        }
示例#3
0
        public ActionResult Delete(RoleItemModel roleItemModel)
        {
            try
            {
                if (IsDelete(roleItemModel.OperationResult))
                {
                    if (Application.Delete(roleItemModel.OperationResult, (Role)roleItemModel.Role.ToData()))
                    {
                        return(JsonResultSuccess(roleItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                roleItemModel.OperationResult.ParseException(exception);
            }

            roleItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(roleItemModel.OperationResult));
        }
示例#4
0
        public ActionResult Delete(string id, string masterEntity = null, string masterKey = null)
        {
            RoleItemModel roleItemModel = new RoleItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(roleItemModel.OperationResult))
                {
                    Role role = Application.GetById(roleItemModel.OperationResult, new object[] { id });
                    if (role != null)
                    {
                        roleItemModel.Role = new RoleViewModel(role);

                        return(ZPartialView("CRUD", roleItemModel));
                    }
                }
            }
            catch (Exception exception)
            {
                roleItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(roleItemModel.OperationResult));
        }
示例#5
0
        public ActionResult Read(string id)
        {
            RoleItemModel roleItemModel = new RoleItemModel(ActivityOperations, "Read");

            try
            {
                if (IsRead(roleItemModel.OperationResult))
                {
                    Role role = Application.GetById(roleItemModel.OperationResult, new object[] { id });
                    if (role != null)
                    {
                        roleItemModel.Role = new RoleViewModel(role);

                        return(ZPartialView("CRUD", roleItemModel));
                    }
                }
            }
            catch (Exception exception)
            {
                roleItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(roleItemModel.OperationResult));
        }