Exemplo n.º 1
0
        private int GetFreeIndex(Relay relay)
        {
            var relays = db.Relays.Where(x => x.DeviceID == relay.DeviceID).ToList<Relay>();

            for (int i = 0; i <= relays.Count(); i++)
            {
                if (!relays.Where(x => x.Index == i).Any())
                {
                    return i;
                }

            }

            return relays.Count()+1;
        }
Exemplo n.º 2
0
 // GET: Relays/Create
 public ActionResult Create(Guid id)
 {         
     Relay relay = new Relay();         
     relay.DeviceID = id;
     return View(relay);
 }