Ejemplo n.º 1
0
 public void saveProduct(product p)
 {
     using (NORBITEntities db = new NORBITEntities())
     {
         db.products.Add(p);
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void submitComplaint(custComplaint c)
 {
     using (NORBITEntities b = new NORBITEntities())
     {
         c.date = DateTime.Now;
         b.custComplaints.Add(c);
         b.SaveChanges();
     }
 }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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();
     }
 }
Ejemplo n.º 5
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();
            }
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
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);
            }
        }