예제 #1
0
        public async Task <ActionResult <object> > Submit([FromBody] DataSubmitRequest request)
        {
            var key = (string)this.ControllerContext.RouteData.Values["key"];

            Log.ObjectId = key;
            //string requestString = IOHelper.StreamToStr(Request.Body);
            //var request = JsonConvert.DeserializeObject<DataSaveRequest>(requestString);
            var result = await _dg.SubmitAsync(key, request);

            return(result as object);
        }
예제 #2
0
        async Task <AppUser> CreateTempUser(string tempId)
        {
            DataGateService dataSvc = Consts.Get <DataGateService>();
            var             newUser = new AppUser
            {
                Id       = tempId,
                Account  = tempId,
                Name     = tempId,
                Password = CommOp.NewId().Substring(8, 16)
            };

            await dataSvc.SubmitAsync("SaveUser", new
            {
                Added = new object[] { newUser }
            });

            return(newUser);
        }
예제 #3
0
        /// <summary>
        /// 注册新用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public async Task <ApiResult> RegisterAsync(AppUser user)
        {
            var result = await CheckNewUserAsync(user);

            DataGateService dataSvc    = Consts.Get <DataGateService>();
            var             existsUser = await _user.GetModelByIdAsync(user.Id);

            if (existsUser == null)
            {
                throw new Exception("非法的注册信息");
            }
            await dataSvc.SubmitAsync("SaveUser", new
            {
                Changed = new object[] { user }
            });

            result.Message = "注册成功";
            return(result);
        }