public ActionResult DeleteConfirmed(Guid?keyId, string deviceId)
        {
            Authorization authorization = db.Authorizations.Find(keyId, deviceId);

            db.Authorizations.Remove(authorization);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "AccessKeyId,DeviceName")] Authorization authorization)
 {
     if (ModelState.IsValid)
     {
         db.Entry(authorization).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DeviceName  = new SelectList(db.Devices, "DeviceName", "DeviceName", authorization.DeviceName);
     ViewBag.AccessKeyId = new SelectList(db.AccessKeys, "Id", "CardUID", authorization.AccessKeyId);
     return(View(authorization));
 }
        // GET: Authorizations/Details/5
        public ActionResult Details(Guid?keyId, string deviceId)
        {
            if (deviceId == null || keyId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Authorization authorization = db.Authorizations.Find(keyId, deviceId);

            if (authorization == null)
            {
                return(HttpNotFound());
            }
            return(View(authorization));
        }
        // GET: Authorizations/Edit/5
        public ActionResult Edit(Guid?keyId, string deviceId)
        {
            if (deviceId == null || keyId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Authorization authorization = db.Authorizations.Find(keyId, deviceId);

            if (authorization == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DeviceName  = new SelectList(db.Devices, "DeviceName", "DeviceName", authorization.DeviceName);
            ViewBag.AccessKeyId = new SelectList(db.AccessKeys, "Id", "CardUID", authorization.AccessKeyId);
            return(View(authorization));
        }