Example #1
0
 // GET api/Kryzzz/
 public IEnumerable<Grid> Get(Guid id,Guid device,string token)
 {
     var ctx = new Context();
     var user = ctx.Users.SingleOrDefault(x => x.Token == id)??new User();
     if (user.Devices.Any(x => x.Device.Token == device))
     {
         if (user.Devices.Single(x => x.Device.Token == device).Device.Name == "Iphone" &&
             !string.IsNullOrEmpty(token))
         {
             user.Devices.Single(x=>x.Device.Token ==device).DeviceToken = token;
             ctx.SaveChanges();
         }
         return null;
     }
     return null;
 }
Example #2
0
 public HomeController()
 {
     _ctx = new Context();
 }