public ActionResult Edit(MonitorEditModel model)
        {
            if (ModelState.IsValid)
            {
                Monitor _monitor = db.Monitors.Find(model.MonitorId);

                _monitor.ApplicationUser = um.FindById(model.ApplicationUserId);
                _monitor.Discarded = model.Discarded;
                _monitor.EquipmentName = model.EquipmentName;
                _monitor.LostOrStolen = model.LostOrStolen;
                _monitor.PurchasePrice = model.PurchasePrice;
                _monitor.SerialNumber = model.SerialNumber;

                if (model.dtSold != null)
                {
                    Sale _sale = new Sale
                        {
                            dtSold = (DateTime)model.dtSold,
                            SalePrice = model.SalePrice ?? 0.0
                        };
                    db.Sales.Add(_sale);
                    db.SaveChanges();
                    _monitor.Sale = _sale;
                }

                db.Entry(_monitor).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            // Validation failed, reassign the list without assigning anything
            string selectId = model.ApplicationUserId;
            model.Users = FullNameUserList(db, selectId);

            return View(model);
        }
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            Monitor _monitor = db.Monitors.Find(id);
            if (_monitor == null)
            {
                return HttpNotFound();
            }

            MonitorEditModel model = new MonitorEditModel(_monitor);

            string selectId = _monitor.ApplicationUser.Id;
            model.Users = FullNameUserList(db, selectId);

            return View(model);
        }