public virtual async Task UpdateAsync(ShopLeaseInfoRequest shopLeaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (shopLeaseInfoRequest == null) { throw new ArgumentNullException(nameof(shopLeaseInfoRequest)); } await Store.UpdateAsync(_mapper.Map <ShopLeaseInfo>(shopLeaseInfoRequest), cancellationToken); }
public virtual async Task <ShopLeaseInfoResponse> CreateAsync(ShopLeaseInfoRequest shopLeaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (shopLeaseInfoRequest == null) { throw new ArgumentNullException(nameof(shopLeaseInfoRequest)); } var facilities = await Store.CreateAsync(_mapper.Map <ShopLeaseInfo>(shopLeaseInfoRequest), cancellationToken); return(_mapper.Map <ShopLeaseInfoResponse>(facilities)); }
public virtual async Task SaveAsync(UserInfo user, string buildingId, ShopLeaseInfoRequest shopLeaseInfoRequest, CancellationToken cancellationToken = default(CancellationToken)) { if (user == null) { throw new ArgumentNullException(nameof(user)); } if (shopLeaseInfoRequest == null) { throw new ArgumentNullException(nameof(shopLeaseInfoRequest)); } await Store.SaveAsync(_mapper.Map <SimpleUser>(user), buildingId, _mapper.Map <ShopLeaseInfo>(shopLeaseInfoRequest), cancellationToken); }
public async Task <ResponseMessage> PutShopLeaseInfo(UserInfo user, [FromRoute] string buildingId, [FromRoute] string shopsId, [FromBody] ShopLeaseInfoRequest shopLeaseInfoRequest) { Logger.Trace($"用户{user?.UserName ?? ""}({user?.Id ?? ""})修改楼盘租赁信息(PutShopLeaseInfo):\r\n请求参数为:\r\n" + (shopLeaseInfoRequest != null ? JsonHelper.ToJson(shopLeaseInfoRequest) : "")); ResponseMessage response = new ResponseMessage(); if (!ModelState.IsValid || shopLeaseInfoRequest.Id != shopsId) { response.Code = ResponseCodeDefines.ModelStateInvalid; response.Message = ModelState.GetAllErrors(); Logger.Warn($"用户{user?.UserName ?? ""}({user?.Id ?? ""})修改楼盘租赁信息(PutShopLeaseInfo)模型验证失败:\r\n{response.Message ?? ""},\r\n请求参数为:\r\n" + (shopLeaseInfoRequest != null ? JsonHelper.ToJson(shopLeaseInfoRequest) : "")); return(response); } try { await _shopLeaseInfoManager.SaveAsync(user, buildingId, shopLeaseInfoRequest, HttpContext.RequestAborted); //var dictionaryGroup = await _shopLeaseInfoManager.FindByIdAsync(shopsId, HttpContext.RequestAborted); //if (dictionaryGroup == null) //{ // await _shopLeaseInfoManager.CreateAsync(shopLeaseInfoRequest, HttpContext.RequestAborted); //} //await _shopLeaseInfoManager.UpdateAsync(shopLeaseInfoRequest, HttpContext.RequestAborted); } catch (Exception e) { response.Code = ResponseCodeDefines.ServiceError; response.Message = e.ToString(); Logger.Error($"用户{user?.UserName ?? ""}({user?.Id ?? ""})修改楼盘租赁信息(PutShopLeaseInfo)请求失败:\r\n{e.ToString()},\r\n请求参数为:\r\n" + (shopLeaseInfoRequest != null ? JsonHelper.ToJson(shopLeaseInfoRequest) : "")); } return(response); }