public override List <Product> SearchAll() { using (RequestItEntities db = new RequestItEntities()) { return(db.Products.ToList()); } }
public override List <RequestsItem> SearchAll() { using (RequestItEntities db = new RequestItEntities()) { return(db.RequestsItems.ToList()); } }
public RequestsItem SearchProductItemOfRequestItem(int productId) { using (RequestItEntities db = new RequestItEntities()) { var request = (from ri in db.RequestsItems where ri.productId == productId select ri).FirstOrDefault(); return(request); } }
public List <RequestsItem> SearchByRequestId(int requestId) { using (RequestItEntities db = new RequestItEntities()) { var request = (from ri in db.RequestsItems where ri.requestId == requestId select ri).ToList(); return(request); } }
public override RequestsItem Search(int id) { using (RequestItEntities db = new RequestItEntities()) { var request = (from requests in db.RequestsItems where requests.id == id select requests).FirstOrDefault(); return(request); } }
public CompoundProduct SearchProductItemOfCompoundProduct(int productId) { using (RequestItEntities db = new RequestItEntities()) { var piocp = (from cp in db.CompoundProducts where (cp.productId == productId) select cp).FirstOrDefault(); return(piocp); } }
public override Product Search(int id) { using (RequestItEntities db = new RequestItEntities()) { var products = (from product in db.Products where product.id == id select product).Include(cp => cp.CompoundProducts).FirstOrDefault(); return(products); } }
public CompoundProduct SearchCompound(int productId, int compoundProductId) { using (RequestItEntities db = new RequestItEntities()) { var cpc = (from cp in db.CompoundProducts where (cp.compoundProductId == compoundProductId) && (cp.productId == productId) select cp).FirstOrDefault(); return(cpc); } }
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); } }
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); } }
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); } }
public override CompoundProduct Search(int id) { using (RequestItEntities db = new RequestItEntities()) { var cpc = (from cp in db.CompoundProducts where cp.id == id join p in db.Products on cp.productId equals p.id select cp).FirstOrDefault(); return(cpc); } }
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); } }
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); } }
public override List <Product> Search(string description) { using (RequestItEntities db = new RequestItEntities()) { if (description != "") { return((from p in db.Products where p.name.ToUpper().Contains(description.ToUpper()) select p).ToList()); } else { return(SearchAll()); } } }
public override List <Request> Search(string employeeName) { using (RequestItEntities db = new RequestItEntities()) { if (employeeName != "") { return((from r in db.Requests where r.employeeName.ToUpper().Contains(employeeName.ToUpper()) select r).ToList()); } else { return(SearchAll()); } } }