// 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; }
public HomeController() { _ctx = new Context(); }