コード例 #1
0
ファイル: UserBLL.cs プロジェクト: xxq860725/Ctrip.SOA
        public BaseResponse UpdateUser(UserModelRequest entity)
        {
            try
            {
                var userEntity = entity.MapTo <UserEntity>();
                var usermodel  = userRepository.GetUser(userEntity.UserId);

                if (usermodel == null)
                {
                    return new BaseResponse {
                               IsSuccess = false, Msg = "can not find mddel"
                    }
                }
                ;


                bool result = userRepository.UpdateUser(usermodel);

                return(result ? new BaseResponse {
                    IsSuccess = true
                } : new BaseResponse {
                    IsSuccess = false
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    IsSuccess = false, Msg = ex.Message
                });
            }
        }
コード例 #2
0
        public BaseResponse DeleteUser(UserModelRequest entity)
        {
            var userEntity = entity.MapTo <UserEntity>();

            userRepository.DeleteUser(userEntity);

            return(new BaseResponse {
                IsSuccess = true
            });
        }
コード例 #3
0
        public UserModelResponse AddUser(UserModelRequest entity)
        {
            var userEntity = entity.MapTo <UserEntity>();

            userEntity.CreateTime = DateTime.Now;
            userEntity.UpdateTime = DateTime.Now;

            long id = userRepository.AddUser(userEntity);

            return(id > 0 ? new UserModelResponse {
                UserId = id, IsSuccess = true
            } : new UserModelResponse {
                IsSuccess = false, UserId = 0
            });
        }
コード例 #4
0
ファイル: UserBLL.cs プロジェクト: xxq860725/Ctrip.SOA
        public BaseResponse DeleteUser(UserModelRequest entity)
        {
            try
            {
                var userEntity = entity.MapTo <UserEntity>();
                userRepository.DeleteUser(userEntity);

                return(new BaseResponse {
                    IsSuccess = true
                });
            }
            catch (Exception ex)
            {
                return(new BaseResponse {
                    IsSuccess = false, Msg = ex.Message
                });
            }
        }
コード例 #5
0
ファイル: UserBLL.cs プロジェクト: xxq860725/Ctrip.SOA
        public UserModelResponse AddUser(UserModelRequest entity)
        {
            try
            {
                var userEntity = entity.MapTo <UserEntity>();

                long id = userRepository.AddUser(userEntity);

                return(id > 0 ? new UserModelResponse {
                    UserId = id, IsSuccess = true
                } : new UserModelResponse {
                    IsSuccess = false, UserId = 0
                });
            }
            catch (Exception ex)
            {
                return(new UserModelResponse {
                    UserId = 0, IsSuccess = false, Msg = ex.Message
                });
            }
        }
コード例 #6
0
        public BaseResponse UpdateUser(UserModelRequest entity)
        {
            var userEntity = entity.MapTo <UserEntity>();
            var usermodel  = userRepository.GetUser(userEntity.UserId);

            if (usermodel == null)
            {
                return new BaseResponse {
                           IsSuccess = false, Msg = "can not find user"
                }
            }
            ;

            usermodel.UpdateTime = DateTime.Now;
            usermodel.UserName   = entity.UserName;
            bool result = userRepository.UpdateUser(usermodel);

            return(result ? new BaseResponse {
                IsSuccess = true
            } : new BaseResponse {
                IsSuccess = false
            });
        }