public virtual async Task UpdateAsync(BuildingShopInfoRequest buildingBaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (buildingBaseInfoRequest == null) { throw new ArgumentNullException(nameof(buildingBaseInfoRequest)); } await Store.UpdateAsync(_mapper.Map <BuildingShopInfo>(buildingBaseInfoRequest), cancellationToken); }
public virtual async Task <BuildingShopInfoResponse> CreateAsync(BuildingShopInfoRequest buildingBaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (buildingBaseInfoRequest == null) { throw new ArgumentNullException(nameof(buildingBaseInfoRequest)); } var baseinfo = await Store.CreateAsync(_mapper.Map <BuildingShopInfo>(buildingBaseInfoRequest), cancellationToken); return(_mapper.Map <BuildingShopInfoResponse>(baseinfo)); }
public virtual async Task SaveAsync(UserInfo user, BuildingShopInfoRequest buildingBaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (buildingBaseInfoRequest == null) { throw new ArgumentNullException(nameof(buildingBaseInfoRequest)); } await Store.SaveAsync(_mapper.Map <SimpleUser>(user), _mapper.Map <BuildingShopInfo>(buildingBaseInfoRequest), cancellationToken); }
public async Task <ResponseMessage> PutBuildingShopsInfo(UserInfo user, [FromRoute] string buildingId, [FromBody] BuildingShopInfoRequest buildingShopInfoRequest) { Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})保存楼盘商铺信息(PutBuildingBaseInfo):\r\n请求参数为:\r\n" + (buildingShopInfoRequest != null ? JsonHelper.ToJson(buildingShopInfoRequest) : "")); ResponseMessage response = new ResponseMessage(); if (!ModelState.IsValid || buildingShopInfoRequest.Id != buildingId) { response.Code = ResponseCodeDefines.ModelStateInvalid; response.Message = ModelState.GetAllErrors(); Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})保存楼盘商铺信息(PutBuildingBaseInfo)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (buildingShopInfoRequest != null ? JsonHelper.ToJson(buildingShopInfoRequest) : "")); return(response); } try { await _buildingShopInfoManager.SaveAsync(user, buildingShopInfoRequest, HttpContext.RequestAborted); } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = e.ToString(); Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})保存楼盘商铺信息(PutBuildingBaseInfo)报错:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (buildingShopInfoRequest != null ? JsonHelper.ToJson(buildingShopInfoRequest) : "")); } return(response); }