Пример #1
0
        public Property create(Property property)
        {
            db.Properties.Add(property);
            int savingresult = db.SaveChanges();

            if (savingresult > 0)
            {
                return(property);
            }
            return(null);
        }
Пример #2
0
        public Category create(Category category)
        {
            db.Categories.Add(category);
            int savingresult = db.SaveChanges();

            if (savingresult > 0)
            {
                return(category);
            }
            return(null);
        }
Пример #3
0
        public Device create(Device device)
        {
            device.Aqusationdate = DateTime.Now;
            db.Devices.Add(device);
            int savingresult = db.SaveChanges();

            if (savingresult > 0)
            {
                return(device);
            }
            return(null);
        }
Пример #4
0
 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));
 }
Пример #5
0
 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);
 }