public async Task <IActionResult> Send(string Id, string text, bool save) { List <string> Ids = new List <string>(); List <Device> device = unit.Device.GetByUserId(Guid.Parse(Id)); device.ForEach(p => Ids.Add(p.PushId)); FireBase.SendNotification(text, Ids); //if (save) //{ // unit.Notification.Add(new Notification { RegisterDate = Utility.Utility.UnixTimeNow(), Text = text }); // unit.Complete(); //} dynamic temp = new { ok = "Ok" }; return(new OkObjectResult(temp)); }
public Response ApproveAppRequest(Int64 AppId, Int64 UserId) { Response r = new Response(); try { FireBase fb = new FireBase(); WebConfig wc = new WebConfig(); string FirebaseKey = wc.AppSettings("AirViewStore"); Sec_UserSettingsDL usd = new Sec_UserSettingsDL(); bool Result = usd.Manage("Set_IsRequestApproved", UserId, AppId, AppId.ToString(), null); if (Result) { var dt = usd.GetDataTable("Get_UserAppToken", UserId.ToString(), AppId.ToString()); if (dt != null && dt.Rows.Count > 0) { dynamic result = fb.SendNotification(FirebaseKey, dt.Rows[0]["Token"].ToString(), "{ \"EmailPIN\": \"" + dt.Rows[0]["EmailPIN"].ToString() + "\", \"MobilePIN\": \"" + dt.Rows[0]["MobilePIN"].ToString() + "\"}"); r.Status = "success"; r.Message = "success"; r.Value = result; } else { r.Status = "error"; r.Message = "Device not found."; } } else { r.Status = "error"; r.Message = "Request not fund."; } } catch (Exception ex) { r.Status = "error"; r.Message = ex.Message; } return(r); }