public ActionResult Edit([Bind(Include = "Id,DeviceNameProperty,Processor,Dimension,MACAddress,IPAddress,AllowUsb,NetWorkSpeed,OperatingSystem,ports,HD,User_Id")] Property property)
 {
     if (ModelState.IsValid)
     {
         property.User_Id         = User.Identity.GetUserId();
         db.Entry(property).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Create", "Device"));
     }
     ViewBag.User_Id = new SelectList(db.AspNetUsers, "Id", "Email", property.User_Id);
     return(View(property));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,SerialNo,Aqusationdate,Memo,Category_Id,Property_Id")] Device property)
 {
     if (ModelState.IsValid)
     {
         property.Aqusationdate = DateTime.Now;
         db.Entry(property).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("IndexDevices","Home");
     }
     //ViewBag.User_Id = new SelectList(db.AspNetUsers, "Id", "Email", property.User_Id);
     ViewBag.Property_Id = new SelectList(db.Properties, "Id", "DeviceNameProperty", property.Id);
    ViewBag.Category_Id = new SelectList(db.Categories, "Id", "Name", property.Id);
     return View(property);
 }
Example #3
0
 public int Updateproperty(Property updatedproperty)
 {
     db.Properties.Attach(updatedproperty);
     db.Entry(updatedproperty).State = System.Data.Entity.EntityState.Modified;
     return(db.SaveChanges());
 }