Browse Source

BMC: Parameter binding issue in SendNotification Method

feature/ModificationForSentNotificationAPI
Palash Biswas 2 years ago
parent
commit
84cb9d4251
1 changed files with 23 additions and 9 deletions
  1. +23
    -9
      BCS.BMC/src/BCS.BMC.Web.Mvc/Controllers/NotificationController.cs

+ 23
- 9
BCS.BMC/src/BCS.BMC.Web.Mvc/Controllers/NotificationController.cs View File

@ -78,19 +78,33 @@ namespace BCS.BMC.Web.Controllers
data.Status= notification.Status;
data.UserId = notification.UserId;
await db.Collection("BMC_Notification").Document().SetAsync(data);
var getTokenDetails = _firebaseToken.GetAllList().Where(x => x.UserId == notification.UserId).FirstOrDefault();
List<string> tokenList = new List<string>();
tokenList.Add(getTokenDetails.FcmToken);
foreach (var item in notification.Id)
{
int userId = Convert.ToInt32(item);
var getTokenDetails = _firebaseToken.GetAllList().Where(x => x.UserId == userId).FirstOrDefault();
List<string> tokenList = new List<string>();
tokenList.Add(getTokenDetails.FcmToken.ToString());
if (getTokenDetails != null)
{
var sendNotificationInfo = new FireBaseResponseModel();
sendNotificationInfo.FcmToken = tokenList;
sendNotificationInfo.notification.Title = "Bwac Patrol Monitoring Alert";
sendNotificationInfo.notification.Body = notification.Message;
await SendNotification(sendNotificationInfo);
var title = notification.SenderName.ToJsonString();
var body = notification.Message.ToJsonString();
var sendNotificationInfo = new FireBaseResponseModel();
{
sendNotificationInfo.FcmToken = tokenList;
}
Notification notifications = new Notification
{
Title = title,
Body = body,
//ImageUrl = null
};
sendNotificationInfo.notification = notifications;
await SendNotification(sendNotificationInfo);
}
}
var entity = new FirebaseCloudMessageDetails();
entity.UserId = notification.UserId;


Loading…
Cancel
Save