示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Save(ImUserInfoModel model)
        {
            if (model.IsNull())
            {
                return(ToJsonErrorResult(1, "参数不能为空"));
            }

            var dto = _imUserInfoService.Save(new ImUserInfoDto
            {
                ImUserId    = model.ImUserId.ToGuid(),
                ImUserName  = model.ImUserName,
                UserHeadimg = model.UserHeadimg,
                UserId      = model.UserId,
                UserType    = model.UserType.ToInt32(),
                Gender      = (model.Gender.IsNullOrEmpty() ? null : (int?)model.Gender.ToInt32()),
                Remark      = model.Remark
            });

            if (dto.ImUserId.IsNullGuid())
            {
                return(ToJsonErrorResult(2, "保存用户信息出错"));
            }
            else
            {
                return(ToJsonResult(new { status = 0, msg = "ok" }));
            }
        }
        public ApiResult <AddCasualResponse> AddCasual(AddCasualRequest request)
        {
            var response = new AddCasualResponse();

            var dto = new ImUserInfoDto();

            dto.ImUserName = request.ImUserName;
            //TODO:处理临时用户头像
            dto.UserHeadimg      = "";
            dto.UserType         = 4;
            dto                  = _imUserInfoService.Save(dto);
            response.ImUserId    = dto.ImUserId;
            response.ImUserName  = dto.ImUserName;
            response.UserHeadimg = dto.UserHeadimg;
            return(Success(response));
        }