public void StartPoll() { DataGenerator dg = new DataGenerator(); Supervisor user = dg.SupervisorGenerator(1); List <Drone> drones = db.Drones.ToList(); foreach (var drone in drones) { Poll state = drone.GetState(drone.Id); Update(drone, state); Insert(drone, state); if (user.CheckUserRole() == "Supervisor") { RefreshState(drone.Id); } AppendToSMSList(drone, state); } if (SMSList.Count > 0) { //sendSms(); } if (user.CheckUserRole() == "Supervisor") { ViewBag.Message = "Poll completed"; } RedirectToAction("Index"); }