コード例 #1
0
 public bool Update(Department  department)
 {
     AssetDBContext db = new AssetDBContext();
     db.Departments.Attach(department);
     db.Entry(department).State = EntityState.Modified;
     int rowAffected = db.SaveChanges();
     return rowAffected > 0;
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Code,Location")] Organization organization)
 {
     if (ModelState.IsValid)
     {
         db.Entry(organization).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(organization));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "Id,Name,Code")] GeneralCategory generalcategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(generalcategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(generalcategory));
 }
コード例 #4
0
        public bool Update(Employee employee)
        {
            AssetDBContext db = new AssetDBContext();

            db.Employees.Attach(employee);
            db.Entry(employee).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
コード例 #5
0
        public bool Update(Category category)
        {
            AssetDBContext db = new AssetDBContext();

            db.Categories.Attach(category);
            db.Entry(category).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
コード例 #6
0
        public bool Update(Vendor vendor)
        {
            AssetDBContext db = new AssetDBContext();

            db.Vendors.Attach(vendor);
            db.Entry(vendor).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
コード例 #7
0
        public bool Update(Location location)
        {
            AssetDBContext db = new AssetDBContext();

            db.Locations.Attach(location);
            db.Entry(location).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
コード例 #8
0
 public ActionResult Edit([Bind(Include = "Id,Name,PhoneNo")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
コード例 #9
0
        public bool Update(GeneralCategory generalCategory)
        {
            AssetDBContext db = new AssetDBContext();

            db.GeneralCategories.Attach(generalCategory);
            db.Entry(generalCategory).State = EntityState.Modified;
            int rowAffected = db.SaveChanges();

            return(rowAffected > 0);
        }
コード例 #10
0
        public bool Update(OrganizationBranch organizationBranch)
        {
            AssetDBContext db = new AssetDBContext();

            db.OrganizationBranches.Attach(organizationBranch);
            db.Entry(organizationBranch).State = EntityState.Modified;
            int rowAffacted = db.SaveChanges();

            return(rowAffacted > 0);
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "Id,Name,ShortName,OrganizationId")] OrganizationBranch organizationbranch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(organizationbranch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrganizationId = new SelectList(db.Organizations, "Id", "Name", organizationbranch.OrganizationId);
     return(View(organizationbranch));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "Id,Name,ShortName,OrganizationBranchId")] AssetLocation assetlocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assetlocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.OrganizationBranchId = new SelectList(db.OrganizationBranches, "Id", "Name", assetlocation.OrganizationBranchId);
     return(View(assetlocation));
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "Id,Name,Code,Price,SerialNo,Description,SubCategoryId")] Asset asset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(asset).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SubCategoryId = new SelectList(db.SubCategories, "Id", "Name", asset.SubCategoryId);
     return(View(asset));
 }
コード例 #14
0
 public ActionResult Edit([Bind(Include = "Id,Name,Code,GeneralCategoryId")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GeneralCategoryId = new SelectList(db.GeneralCategories, "Id", "Name", category.GeneralCategoryId);
     return(View(category));
 }
コード例 #15
0
 public ActionResult Edit([Bind(Include = "Id,AssetId,OrganizationId,SerialNo,RegistrationCode,Code,AssetLocationId,EmployeeId")] AssetRegistration assetregistration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assetregistration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AssetId         = new SelectList(db.Assets, "Id", "Name", assetregistration.AssetId);
     ViewBag.AssetLocationId = new SelectList(db.AssetLocations, "Id", "Name", assetregistration.AssetLocationId);
     ViewBag.EmployeeId      = new SelectList(db.Employees, "Id", "Name", assetregistration.EmployeeId);
     ViewBag.OrganizationId  = new SelectList(db.Organizations, "Id", "Name", assetregistration.OrganizationId);
     return(View(assetregistration));
 }