Exemplo n.º 1
0
 public void saveProduct(product p)
 {
     using (NORBITEntities db = new NORBITEntities())
     {
         db.products.Add(p);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public List <product> getAllProducts()
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         var q = from x in b.products
                 select x;
         return(q.ToList());
     }
 }
Exemplo n.º 3
0
 public void submitComplaint(custComplaint c)
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         c.date = DateTime.Now;
         b.custComplaints.Add(c);
         b.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public product getProduct(int?id)
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         var q = from x in b.products
                 where x.Id == id
                 select x;
         return(q.ToList().ElementAt(0));
     }
 }
Exemplo n.º 5
0
 public List <category> getAllCategories()
 {
     using (NORBITEntities db = new NORBITEntities())
     {
         var q = from c in db.categories
                 select c;
         List <category> list = q.ToList();
         return(list);
     }
 }
Exemplo n.º 6
0
        public bool addCategory(string name)
        {
            using (NORBITEntities db = new NORBITEntities())
            {
                category cat = new category();
                cat.name = name;
                db.categories.Add(cat);

                db.SaveChanges();
                return(true);
            }
        }
Exemplo n.º 7
0
 public List <ComplaintList> getAllComplaints()
 {
     using (NORBITEntities db = new NORBITEntities())
     {
         var q = from x in db.custComplaints
                 orderby x.Id descending
                 select new ComplaintList {
             subject = x.subject, Id = x.Id, name = x.name, email = x.email, status = x.status, date = x.date
         };
         return(q.ToList());
     }
 }
Exemplo n.º 8
0
 public List <Product_Grid> getProductsByCategory(int?catid)
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         var q = from x in b.products
                 where x.catid == catid
                 select new Product_Grid {
             pagepath = x.pagepath, Id = x.Id, name = x.name, imgpath = x.imgpath, model = x.model
         };
         return(q.ToList());
     }
 }
Exemplo n.º 9
0
 public void editCategory(category c)
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         var q = from x in b.categories
                 where x.Id == c.Id
                 select x;
         category toEdit = q.ToList().ElementAt(0);
         toEdit.name = c.name;
         b.SaveChanges();
     }
 }
Exemplo n.º 10
0
        public void removeCategory(string id)
        {
            int cid = Convert.ToInt32(id);

            using (NORBITEntities db = new NORBITEntities())
            {
                category c = new category();
                var      q = from x in db.categories
                             where x.Id == cid
                             select x;

                c = q.ToList().ElementAt(0);
                db.categories.Remove(c);
                db.SaveChanges();
            }
        }
Exemplo n.º 11
0
        public string getComplaintContent(string id)
        {
            int i = Convert.ToInt32(id);

            using (NORBITEntities b = new NORBITEntities())
            {
                var q = from x in b.custComplaints
                        where x.Id == i
                        select x;
                custComplaint c       = q.ToList().ElementAt(0);
                string        message = c.message;
                c.status = 1;
                b.SaveChanges();


                return(message);
            }
        }
Exemplo n.º 12
0
        public string[] removeProduct(string id)
        {
            int pid = Convert.ToInt32(id);

            using (NORBITEntities db = new NORBITEntities())
            {
                product p = new product();
                var     q = from x in db.products
                            where x.Id == pid
                            select x;
                p = q.ToList().ElementAt(0);
                string   pagepath = p.pagepath, imgpath = p.imgpath;
                string[] paths = new string[] { p.pagepath, p.imgpath };
                db.products.Remove(p);
                db.SaveChanges();
                return(paths);
            }
        }