Example #1
0
 public void UpdateItem(string updateCartID, int updateAttributeId, bool OnOff)
 {
     using (var _db = new TrojanWebRebuild.Models.TrojanContext())
     {
         try
         {
             var myItem = (from c in _db.Virus_Item where c.VirusId == updateCartID && c.Attribute.AttributeId == updateAttributeId select c).FirstOrDefault();
             if (myItem != null)
             {
                 myItem.On_Off = OnOff;
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to update decription - " + exp.Message.ToString(), exp);
         }
     }
 }
Example #2
0
 public void RemoveItem(string removeCartID, int removeAttributeId)
 {
     using (var _db = new TrojanWebRebuild.Models.TrojanContext())
     {
         try
         {
             var myItem = (from c in _db.Virus_Item where c.VirusId == removeCartID && c.Attribute.AttributeId == removeAttributeId select c).FirstOrDefault();
             if (myItem != null)
             {
                 // Remove Item.
                 _db.Virus_Item.Remove(myItem);
                 _db.SaveChanges();
             }
         }
         catch (Exception exp)
         {
             throw new Exception("ERROR: Unable to Remove Description Item - " + exp.Message.ToString(), exp);
         }
     }
 }