Esempio n. 1
0
 public admin GetAdmin(string id)
 {
     try
     {
         using (etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities())
         {
             admin ifadmin = db.admins.Find(id);
             return(ifadmin);
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Esempio n. 2
0
        public string AddAdmin(admin admin)
        {
            try
            {
                etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities();
                db.admins.Add(admin);
                db.SaveChanges();
                return(admin.email + " was successfully added");
            }

            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Esempio n. 3
0
        public String CreateShipment(shipment ship)
        {
            try
            {
                etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities();
                db.shipments.Add(ship);
                db.SaveChanges();
                return("Order successful by: " + ship.customer_customer_email);
            }

            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Esempio n. 4
0
 public List <shipment> MyOrders(String email)
 {
     try
     {
         using (etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities())
         {
             List <shipment> shipments = (from x in db.shipments where x.customer_customer_email == email select x).ToList();
             return(shipments);
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Esempio n. 5
0
 public List <shipment> GetAllShipments()
 {
     try
     {
         using (etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities())
         {
             List <shipment> shipments = (from x in db.shipments select x).ToList();
             return(shipments);
         }
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Esempio n. 6
0
 public shipment GetShipment(int id)
 {
     try
     {
         using (etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities())
         {
             shipment ship = db.shipments.Find(id);
             return(ship);
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Esempio n. 7
0
        public string RemoveAdmin(string email)
        {
            try
            {
                etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities();
                admin p = db.admins.Find(email);
                db.admins.Attach(p);
                db.admins.Remove(p);
                db.SaveChanges();
                return(p.email + " was successfully deleted");
            }

            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Esempio n. 8
0
        public String DeleteShipment(int id)
        {
            try
            {
                etvffqgz_megastoreEntities db = new etvffqgz_megastoreEntities();
                shipment p = db.shipments.Find(id);
                db.shipments.Attach(p);
                db.shipments.Remove(p);
                db.SaveChanges();
                return(p.shipment_id + " was successfully deleted");
            }

            catch (Exception e)
            {
                return("Error:" + e);
            }
        }