private async Task <LandlordActivityViewModel> GetLandlordActivities( string landlordId) { var request = new GetLandlordActivityRequest() { LandlordId = landlordId, Filter = GetFilterDto() }; var content = CreateContent(request); HttpClient.DefaultRequestHeaders.Authorization = GetAuthHeader(); var response = await HttpClient.PostAsync( Configuration["Url:LandlordActivities"], content); switch (response.StatusCode) { case HttpStatusCode.OK: var okResponse = await response.GetOkResponseAsync(); var result = Deserialize <LandlordActivityViewModel>(okResponse.ResultString); return(result); default: return(new LandlordActivityViewModel() { TotalRecords = 0, Activity = new List <LandlordActivityDto>() }); } }
public async Task <IActionResult> GetLandlordActivitiesAsync( [FromBody] GetLandlordActivityRequest request) { if (ModelState.IsValid) { var result = await _landlordService.GetLandlordActivitiesAsync(request); return(StatusCode(result.Status, result.Payload)); } return(GetBadRequestResult()); }
public async Task <ResponseMessage> GetLandlordActivitiesAsync( GetLandlordActivityRequest request) { try { var result = await Mediator.Send(request); return(OkResponse(result)); } catch (Exception ex) { return(GetResponseMessageForException(ex)); } }