Beispiel #1
0
        public bool InsertOrUpdate(UserDto dto, UserDto createUser)
        {
            UserDto cuser, olddto = null;

            if (default(Guid).Equals(dto.Id)) //add
            {
                cuser = dto;
                if (createUser != null)
                {
                    cuser.CreateUserId = createUser.Id;
                    cuser.CreateTime   = DateTime.Now;
                }
            }
            else //edit
            {
                olddto             = Get(dto.Id);
                cuser              = olddto.GetCopy();
                cuser.Name         = dto.Name;
                cuser.UserName     = dto.UserName;
                cuser.Email        = dto.Email;
                cuser.MobileNumber = dto.MobileNumber;
                cuser.Remarks      = dto.Remarks;
            }

            user_update_insertupdate_rpc user = null;

            Request(cuser, olddto, user, 0);  //异步rpc的方式
            //var user = _repository.InsertOrUpdate(Mapper.Map<User>(dto));
            return(true);
        }
Beispiel #2
0
        public bool Update(UserDto dto)
        {
            UserDto cuser, olddto = null;

            olddto             = Get(dto.Id);
            cuser              = olddto.GetCopy();
            cuser.NickName     = dto.NickName;
            cuser.EMail        = dto.EMail;
            cuser.MobileNumber = dto.MobileNumber;
            cuser.Address      = dto.Address;

            crm_user_update_rpc user = null;

            Request(cuser, olddto, user, 0);  //异步rpc的方式
            //var user = _repository.InsertOrUpdate(Mapper.Map<User>(dto));
            return(true);
        }