private async Task <StringContent> SetupJPushModel(string userEmail, bool accepted = false) { var user = await _userManager.FindByEmailAsync(userEmail); if (string.IsNullOrEmpty(user.JPushId)) { user.JPushId = "170976fa8a3330841b0"; } var jpush = new JPushModel() { audience = new Audience() { tag = new List <string>() }, message = new Message() }; return(jpush.Action(d => d.audience.tag.Add(user.JPushId)) .Action(d => d.platform = "all") .Action(d => d.message.msg_content = accepted ? "Your request has beed accepted." : "Your request was rejected.") .Map(d => JsonSerializer.Serialize(d).Map(d => new StringContent(d, Encoding.UTF8, "application/json")))); }
private async Task <StringContent> SetupJPushModel() { var clientServer = await _userManager.Users.FirstAsync(d => d.IsClientServer); if (string.IsNullOrEmpty(clientServer.JPushId)) { clientServer.JPushId = "170976fa8a3330841b0"; } var jpush = new JPushModel() { audience = new Audience() { tag = new List <string>() }, message = new Message() }; return(jpush.Action(d => d.audience.tag.Add("170976fa8a3330841b0")) .Action(d => d.platform = "all") .Action(d => d.message.msg_content = $"User {User.Identity.Name} sent a video request.") .Map(d => JsonSerializer.Serialize(d)) .Map(d => new StringContent(d, Encoding.UTF8, "application/json"))); }