BMC: Change Conditions for UpdateBmcMessageStatus method
This commit is contained in:
parent
e7999cda7d
commit
9798125d18
@ -10,6 +10,7 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
{
|
||||
public List<string> UserId { get; set; }
|
||||
public long? ScheduleGenerationId { get; set; }
|
||||
public List<long> BmcIDs { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string CompanyUrl { get; set; }
|
||||
public bool IsSuccess { get; set; }
|
||||
|
@ -23,6 +23,7 @@ namespace BCS.BMC.FirebaseCloudMessaging.Dto
|
||||
|
||||
public bool Status { get; set; }
|
||||
public List<string> UserId { get; set; }
|
||||
public List<long> BmcIDs { get; set; }
|
||||
public string CompanyUrl { get; set; }
|
||||
public long? ScheduleGenerationId { get; set; }
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ namespace BCS.BMC.Web.Controllers
|
||||
public async Task<IActionResult> SendNotification([FromBody] FireBaseResponseModel notification)
|
||||
{
|
||||
var result = await _notificationService.SendNotification(notification);
|
||||
|
||||
|
||||
if (result.SuccessCount>0)
|
||||
|
||||
if (result.SuccessCount > 0)
|
||||
{
|
||||
if(notification.getResponseData != null)
|
||||
if (notification.getResponseData != null)
|
||||
{
|
||||
notification.getResponseData.IsSuccess = true;
|
||||
notification.getResponseData.Status = "Delivered";
|
||||
@ -76,7 +76,7 @@ namespace BCS.BMC.Web.Controllers
|
||||
await UpdateBmcMessageStatus(notification.getResponseData);
|
||||
return BadRequest(result.Responses);
|
||||
}
|
||||
|
||||
|
||||
return Ok(result.Responses);
|
||||
}
|
||||
|
||||
@ -108,7 +108,8 @@ namespace BCS.BMC.Web.Controllers
|
||||
{
|
||||
responseData.UserId = notification.UserId;
|
||||
responseData.ScheduleGenerationId = notification.ScheduleGenerationId;
|
||||
responseData.CompanyUrl = notification.CompanyUrl;
|
||||
responseData.CompanyUrl = notification.CompanyUrl;
|
||||
responseData.BmcIDs = notification.BmcIDs;
|
||||
}
|
||||
|
||||
int userId = 0;
|
||||
@ -160,32 +161,14 @@ namespace BCS.BMC.Web.Controllers
|
||||
{
|
||||
var companyDetails = _companyMasterService.GetAllList().Where(x => x.Url.Trim() == bmcMessageStatusInput.CompanyUrl.Trim()).FirstOrDefault();
|
||||
var baseUrl = companyDetails.Url + "api/services/bwac/updateBmcMessageStatus/UpdateMessageStatus";
|
||||
if (baseUrl == null)
|
||||
{
|
||||
return BadRequest("Invalid Company Url");
|
||||
}
|
||||
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
List<string> usrId = new List<string>();
|
||||
foreach (var uId in bmcMessageStatusInput.UserId)
|
||||
{
|
||||
usrId.Add(uId.ToString());
|
||||
}
|
||||
foreach (var userid in usrId)
|
||||
{
|
||||
var data = new BmcMessageStatusInput();
|
||||
{
|
||||
data.UserId = bmcMessageStatusInput.UserId;
|
||||
data.ScheduleGenerationId = bmcMessageStatusInput.ScheduleGenerationId;
|
||||
data.Status = bmcMessageStatusInput.Status.ToString();
|
||||
data.CompanyUrl = bmcMessageStatusInput.CompanyUrl;
|
||||
data.IsSuccess = bmcMessageStatusInput.IsSuccess;
|
||||
};
|
||||
var requestJson = JsonConvert.SerializeObject(data);
|
||||
var requestContent = new StringContent(requestJson.ToString());
|
||||
requestContent.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
|
||||
HttpResponseMessage response = await client.PostAsync(baseUrl, requestContent);
|
||||
}
|
||||
var requestJson = JsonConvert.SerializeObject(bmcMessageStatusInput);
|
||||
var requestContent = new StringContent(requestJson.ToString());
|
||||
requestContent.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
|
||||
HttpResponseMessage response = await client.PostAsync(baseUrl, requestContent);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user