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); }
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); }
/// <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); }