public bool Get()
 {
     using (CafeDBContext db = new CafeDBContext())
     {
         return(db.Status.OrderByDescending(p => p.Data).Take(1).Select(a => a.Pronto).FirstOrDefault());
     }
 }
Example #2
0
        public async Task Unregister([FromBody] PushRegisterModel endpoint)
        {
            var registerId = endpoint?.Endpoint?.Replace("https://android.googleapis.com/gcm/send/", "");

            if (registerId != null)
            {
                using (var contexto = new CafeDBContext())
                {
                    var pushDevice = contexto.PushDevices.Where(a => a.Endpoint == registerId).FirstOrDefault();
                    if (pushDevice != null)
                    {
                        contexto.PushDevices.Remove(pushDevice);
                        await contexto.SaveChangesAsync();
                    }
                }
            }
        }