Ejemplo n.º 1
0
        public async Task <IActionResult> PushEvent(string EventName, int DeviceID)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            Events evnt = new Events();

            evnt.DeviceID  = DeviceID;
            evnt.EventName = EventName;
            evnt.Initialize();

            AdminUser au = new AdminUser();

            au.getDevices(user.FBToken);
            DeviceVM device = _mapper.Map <DeviceVM>(db.Devices.FirstOrDefault(d => d.Id == DeviceID));

            device.SetEventToBeSend(evnt);

            FirebaseSetting fbs = new FirebaseSetting();

            fbs = db.FirebaseSettings.FirstOrDefault();
            FirebaseSupportService fbss = new FirebaseSupportService(fbs, _mapper);

            fbss.MaketheAPICall(device);

            return(View(evnt));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Devices(string userID)
        {
            AdminUser au   = new AdminUser();
            var       user = await _userManager.FindByIdAsync(userID);

            au.getDevices(user.FBToken);
            au.Devices = db.Devices.Where(d => d.UserId == userID).Select(d => _mapper.Map <DeviceVM>(d)).ToList();
            return(PartialView("Templates/Devices", au));
        }