Exemplo n.º 1
0
        public async Task<ActionResult> AttendanceWinform([FromBody]AttendanceWinformRequest request)
        {
            ActionResult response = NotFound();
            try
            {
                AttendanceService service = new AttendanceService(_unitOfWork);
                Message message = service.CreateMessageOfWinform(request);
                if(message!= null)
                {
                    // Send a message to the device corresponding to the provided
                    // registration token.
                    String HTTPProtocol = await FirebaseMessaging.DefaultInstance.SendAsync(message).ConfigureAwait(true);

                    JObject o = new JObject(new JProperty("name", HTTPProtocol));

                    response = Ok(o);
                    // Response is a message ID string.
                }  

            }
            catch
            {
                response = BadRequest();
            }
            return response;
        }