public ActionResult Create(Models.MSTR_BlackBox BlackBoxData) {
      if (!exLogic.User.hasAccess("BLACKBOX.CREATE"))
        return RedirectToAction("NoAccess", "Home");
      if (ModelState.IsValid) {
        BlackBox BB = new BlackBox();
        //  BlackBox.BlackBoxID = 0;
        BlackBoxData.IsActive = 1;
        BlackBoxData.CurrentStatus = "IN";
        BlackBoxData.LastReceiveId = 0;
        BlackBoxData.LastRentalId = 0;
        BlackBoxData.CreatedBy = Util.getLoginUserID();
        BlackBoxData.CreatedOn = DateTime.Now;
        BlackBoxData.LastUpdateDate = DateTime.Now;
        BlackBoxData.BlackBoxCode = BB.getSerialNumber(BlackBoxData.BlackBoxSerial).ToString();
        db.MSTR_BlackBox.Add(BlackBoxData);

        db.SaveChanges();

        db.Dispose();

        return RedirectToAction("BlackBoxList", "BlackBox");
      } else {
        ViewBag.Title = "Create BlackBox";
        return View(BlackBoxData);
      }
    }
    public ActionResult BlackBoxDetails([Bind(Prefix = "ID")] int BlackBoxID) {
      // if (!exLogic.User.hasAccess("PARTS.VIEW")) return RedirectToAction("NoAccess", "Home");

      Models.MSTR_BlackBox BB = db.MSTR_BlackBox.Find(BlackBoxID);
      ViewBag.EncryptionKeyStatus = false;
      if (exLogic.User.hasAccess("BLACKBOX.AES")) {
        ViewBag.EncryptionKeyStatus = true;
        if (BB != null)
          ViewBag.EncryptionKey = BB.EncryptionKey;
      }
      if (BB == null)
        return RedirectToAction("Error", "Home");
      ViewBag.Title = "Black Box Details";
      return View(BB);
    }