Пример #1
0
        public ActionResult Update(UserItemModel userItemModel)
        {
            try
            {
                if (IsUpdate(userItemModel.OperationResult))
                {
                    if (IsValid(userItemModel.OperationResult, userItemModel.User))
                    {
                        User user = (User)userItemModel.User.ToData();
                        if (Application.Update(userItemModel.OperationResult, user))
                        {
                            if (userItemModel.IsSave)
                            {
                                return(JsonResultSuccess(userItemModel.OperationResult,
                                                         Url.Action("Update", "User", new { Id = user.Id }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(userItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                userItemModel.OperationResult.ParseException(exception);
            }

            userItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(userItemModel.OperationResult));
        }
Пример #2
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            UserItemModel userItemModel = new UserItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(userItemModel.OperationResult));
        }
Пример #3
0
        public ActionResult Delete(UserItemModel userItemModel)
        {
            try
            {
                if (IsDelete(userItemModel.OperationResult))
                {
                    if (Application.Delete(userItemModel.OperationResult, (User)userItemModel.User.ToData()))
                    {
                        return(JsonResultSuccess(userItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                userItemModel.OperationResult.ParseException(exception);
            }

            userItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(userItemModel.OperationResult));
        }
Пример #4
0
        public ActionResult Delete(string id, string masterEntity = null, string masterKey = null)
        {
            UserItemModel userItemModel = new UserItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(userItemModel.OperationResult))
                {
                    User user = Application.GetById(userItemModel.OperationResult, new object[] { id });
                    if (user != null)
                    {
                        userItemModel.User = new UserViewModel(user);

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

            return(JsonResultOperationResult(userItemModel.OperationResult));
        }
Пример #5
0
        public ActionResult Read(string id)
        {
            UserItemModel userItemModel = new UserItemModel(ActivityOperations, "Read");

            try
            {
                if (IsRead(userItemModel.OperationResult))
                {
                    User user = Application.GetById(userItemModel.OperationResult, new object[] { id });
                    if (user != null)
                    {
                        userItemModel.User = new UserViewModel(user);

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

            return(JsonResultOperationResult(userItemModel.OperationResult));
        }