Exemplo n.º 1
0
 public override bool Delete(Product obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         Product product = (from p in db.Products
                            where p.id == obj.id
                            select p).FirstOrDefault();
         db.Products.Remove(product);
         return(db.SaveChanges() > 0);
     }
 }
Exemplo n.º 2
0
 public override bool Delete(RequestsItem obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         RequestsItem requestItem = (from ri in db.RequestsItems
                                     where ri.id == obj.id
                                     select ri).FirstOrDefault();
         db.RequestsItems.Remove(requestItem);
         return(db.SaveChanges() > 0);
     }
 }
Exemplo n.º 3
0
 public override bool Delete(CompoundProduct obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         CompoundProduct compoundProduct = (from cp in db.CompoundProducts
                                            where cp.id == obj.id
                                            select cp).FirstOrDefault();
         db.CompoundProducts.Remove(compoundProduct);
         return(db.SaveChanges() > 0);
     }
 }
Exemplo n.º 4
0
 public bool DeleteByRequestId(int requestId)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         List <RequestsItem> requestItems = (from ri in db.RequestsItems
                                             where ri.requestId == requestId
                                             select ri).ToList();
         foreach (RequestsItem requestItem in requestItems)
         {
             db.RequestsItems.Remove(requestItem);
         }
         return(db.SaveChanges() > 0);
     }
 }
Exemplo n.º 5
0
 public override bool Save(bool Insert, RequestsItem obj)
 {
     using (RequestItEntities db = new RequestItEntities())
     {
         if (Insert)
         {
             db.RequestsItems.Add(obj);
         }
         else
         {
             db.RequestsItems.Attach(obj);
             db.Entry(obj).State = EntityState.Modified;
         }
         return(db.SaveChanges() > 0);
     }
 }