public ActionResult CreateAccessory(EquipmentAccessories objEquip)
 {
     EquipmentAccessories objNewEquip = new EquipmentAccessories();
     objNewEquip.EquipID = objEquip.EquipID;
     objNewEquip.AccessoryName = objEquip.AccessoryName;
     objNewEquip.Manufacturer = objEquip.Manufacturer;
     objNewEquip.PartNumber = objEquip.PartNumber;
     objNewEquip.QuantityonHand = objEquip.QuantityonHand;
     objNewEquip.SupplyQuantity = objEquip.SupplyQuantity;
     objNewEquip.StatusID = 1;
     objDbContext.EquipmentAccessorys.Add(objNewEquip);
     objDbContext.SaveChanges();
     return Json(new { data = "Success" });
 }
        public ActionResult EditAccessory(EquipmentAccessories objEquip)
        {
            EquipmentAccessories objNewEquip = (from p in objDbContext.EquipmentAccessorys
                                                where p.AccessoryID == objEquip.AccessoryID
                                                select p).FirstOrDefault();

            objNewEquip.EquipID = objEquip.EquipID;
            objNewEquip.AccessoryName = objEquip.AccessoryName;
            objNewEquip.Manufacturer = objEquip.Manufacturer;
            objNewEquip.PartNumber = objEquip.PartNumber;
            objNewEquip.QuantityonHand = objEquip.QuantityonHand;
            objNewEquip.SupplyQuantity = objEquip.SupplyQuantity;
            objDbContext.SaveChanges();
            return Json(new { data = "Success" });
        }
        public ActionResult GetEquipentAccessoryData(EquipmentAccessories objEquip)
        {
            var EquipmentsList = (from p in objDbContext.EquipmentAccessorys
                                  where p.AccessoryID == objEquip.AccessoryID
                                  select new {p.AccessoryName, p.equip.Equip_Name, p.PartNumber, p.SupplyQuantity, p.QuantityonHand, p.Manufacturer }).ToList();

            return Json(EquipmentsList);
        }
 public ActionResult DeleteAccessory(EquipmentAccessories objEquip)
 {
     var USerlst = (from p in objDbContext.EquipmentAccessorys
                    where p.AccessoryID == objEquip.AccessoryID
                    select new { p.EquipID,p.AccessoryName, p.PartNumber, p.SupplyQuantity, p.QuantityonHand, p.Manufacturer, p.StatusID }).ToList()[0];
     EquipmentAccessories usr = objDbContext.EquipmentAccessorys.Where(p => p.AccessoryID == objEquip.AccessoryID).First();
     usr.StatusID = 2;
     objDbContext.SaveChanges();
     return Json(new { data = "Success" });
 }