public Property create(Property property) { db.Properties.Add(property); int savingresult = db.SaveChanges(); if (savingresult > 0) { return(property); } return(null); }
public Category create(Category category) { db.Categories.Add(category); int savingresult = db.SaveChanges(); if (savingresult > 0) { return(category); } return(null); }
public Device create(Device device) { device.Aqusationdate = DateTime.Now; db.Devices.Add(device); int savingresult = db.SaveChanges(); if (savingresult > 0) { return(device); } return(null); }
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); }