Exemple #1
0
        public ActionResult Edit([Bind(Include = "AssetID,AssetDescription,EmployeeID,AssetCategoryID,StatusID,DepartmentID,VendorID,Make,ModelNumber,SerialNumber,DateAcquired,DateSold,PurchasePrice,DepreciationMethod,DepreciableLife,SalvageValue,CurrentValue,Comments,Description,NextSchedMaint,Processor,RAM,Condition,ComputerName,GroupID")] Asset asset)
        {
            if (asset.AssetID > 0)
            {
                //asset = db.Assets.Find(asset);
                db.Assets.Attach(asset);

                if (ModelState.IsValid)
                {
                    try
                    {
                        db.Entry(asset).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                    catch (OptimisticConcurrencyException ex)
                    {
                        db.Refresh(RefreshMode.ClientWins, db.Assets);
                        db.SaveChanges();
                    }
                    //db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            ViewBag.ManagerListID   = new SelectList(db.ManagerLists, "EmployeeID", "FirstName", asset.EmployeeID);
            ViewBag.EmployeeID      = new SelectList(db.Employees, "EmployeeID", "FirstName", "LastName", asset.EmployeeID);
            ViewBag.AssetCategoryID = new SelectList(db.Asset_Categories, "AssetCategoryID", "AssetCategory", asset.AssetCategoryID);
            ViewBag.DepartmentID    = new SelectList(db.Departments, "DepartmentID", "DepartmentName", asset.DepartmentID);
            ViewBag.StatusID        = new SelectList(db.Status, "StatusID", "Status1", asset.StatusID);
            ViewBag.VendorID        = new SelectList(db.Vendors, "VendorID", "VendorName", asset.VendorID);
            return(View(asset));
        }
Exemple #2
0
        public ActionResult Edit([Bind(Include = "Id,Firm_Invoice,Case_Name,Status,Invoice_Date,Appealable_Items,Total_Billed,pdf")] Invoice invoice, HttpPostedFileBase files)
        {
            if (ModelState.IsValid)
            {
                db.Entry(invoice).State = EntityState.Modified;
                db.SaveChanges();
            }
            String FileExt = Path.GetExtension(files.FileName).ToUpper();

            if (FileExt == ".PDF")
            {
                Stream       str     = files.InputStream;
                BinaryReader Br      = new BinaryReader(str);
                Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);

                FileDetailsModel Fd = new Models.FileDetailsModel();
                Fd.FileName = files.FileName;
                Fd.pdf      = FileDet;
                Fd.Id       = invoice.Id;
                EditFileDetails(Fd);
                return(RedirectToAction("Index"));
            }

            return(View(invoice));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "EmployeeID,DepartmentID,FirstName,LastName,OfficeLocation,GroupID")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", employee.DepartmentID);
     ViewBag.EmployeeID   = new SelectList(db.Employee_Assets, "Employee_AssetID", "Employee_AssetID", employee.EmployeeID);
     ViewBag.GroupID      = new SelectList(db.Groups, "GroupID", "GroupName", employee.GroupID);
     return(View(employee));
 }
Exemple #4
0
 public ActionResult Edit([Bind(Include = "ManagerListID,EmployeeID,GroupID")] ManagerList managerList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(managerList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ManagerListID = new SelectList(db.Assets, "AssetID", "AssetDescription", managerList.ManagerListID);
     ViewBag.EmployeeID    = new SelectList(db.Employees.Where(x => x.GroupID == 1), "EmployeeID", "FirstName", managerList.EmployeeID);
     ViewBag.GroupID       = new SelectList(db.Groups, "GroupID", "GroupName", managerList.GroupID);
     return(View(managerList));
 }