public void Post(Photo value)
 {
     using (BuySellBidsContext myDB = new BuySellBidsContext())
     {
         myDB.Photos.Add(value);
         myDB.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Post(PersonItem value)
 {
     using (BuySellBidsContext myDB = new BuySellBidsContext())
     {
         myDB.PersonItems.Add(value);
         myDB.SaveChanges();
     }
 }
        public void Put(int id, Photo value)
        {
            Photo PhotoToUpdate;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PhotoToUpdate = myDB.Photos.Where(t => t.PhotoId == id).First();
                myDB.Photos.Update(PhotoToUpdate);
                myDB.SaveChanges();
            }
        }
        public void Put(int id, Person value)
        {
            Person PersonToUpdate;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PersonToUpdate = myDB.Persons.Where(t => t.PersonId == id).First();
                myDB.Persons.Update(PersonToUpdate);
                myDB.SaveChanges();
            }
        }
Exemplo n.º 5
0
        public void Put(int id, Item value)
        {
            Item ItemToUpdate;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                ItemToUpdate = myDB.Items.Where(t => t.ItemId == id).First();
                myDB.Items.Update(ItemToUpdate);
                myDB.SaveChanges();
            }
        }
        public void Delete(int id)
        {
            Photo PhotoToDelete;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PhotoToDelete = myDB.Photos.Where(t => t.PhotoId == id).First();
                myDB.Photos.Remove(PhotoToDelete);
                myDB.SaveChanges();
            }

            // using( BuySellBidsContext myDB = new BuySellBidsContext())
            // {
            //     myDB.Entry(BuyerToDelete).State = EntityState.Deleted;
            //     myDB.SaveChanges();
            // }
        }