コード例 #1
0
 public void Post(PersonItem value)
 {
     using (BuySellBidsContext myDB = new BuySellBidsContext())
     {
         myDB.PersonItems.Add(value);
         myDB.SaveChanges();
     }
 }
コード例 #2
0
 public void Post(Photo value)
 {
     using (BuySellBidsContext myDB = new BuySellBidsContext())
     {
         myDB.Photos.Add(value);
         myDB.SaveChanges();
     }
 }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
        public List <PersonItem> GetPersonsForItem(int id)
        {
            List <PersonItem> PersonItemInContext;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PersonItemInContext = myDB.PersonItems.Where(t => t.ItemId == id).ToList();
            }

            return(PersonItemInContext);
        }
コード例 #6
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();
            }
        }
コード例 #7
0
        public PersonItem Get(int id)
        {
            PersonItem PersonItemInContext;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PersonItemInContext = myDB.PersonItems.Where(t => t.PersonItemId == id).First();
            }

            return(PersonItemInContext);
        }
コード例 #8
0
        public Photo Get(int id)
        {
            Photo PhotoInContext;

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

            return(PhotoInContext);
            //var Buyers = myDB.Photos.Where(t=> t.PhotoIdId==id).Include(t=>t.BuyerEntity).Include(t=>t.Items);
            //return Buyers.First();

            //return "value";
        }
コード例 #9
0
        public ItemType Get(int id)
        {
            ItemType ItemTypeInContext;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                ItemTypeInContext = myDB.ItemTypes.Where(t => t.ItemTypeId == id).First();
            }

            return(ItemTypeInContext);
            //var Buyers = myDB.ItemTypes.Where(t=> t.ItemTypeIdId==id).Include(t=>t.BuyerEntity).Include(t=>t.ItemTypes);
            //return Buyers.First();

            //return "value";
        }
コード例 #10
0
        public Status Get(int id)
        {
            Status StatusInContext;

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                StatusInContext = myDB.Statuses.Where(t => t.StatusId == id).First();
            }

            return(StatusInContext);
            //var Buyers = myDB.Persons.Where(t=> t.PersonIdId==id).Include(t=>t.BuyerEntity).Include(t=>t.Items);
            //return Buyers.First();

            //return "value";
        }
コード例 #11
0
        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();
            // }
        }
コード例 #12
0
        public IEnumerable <Photo> Get()
        {
            List <Photo> PhotoList = new List <Photo>();

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                PhotoList = myDB.Photos.ToList();
            }
            return(PhotoList);

            // BuyerId = 1;
            // Photo BuyerEntity;
            // List<ListItem> Items;
            // bool BuyerStatus;

            //     return BuyerList;
        }
コード例 #13
0
        public IEnumerable <Item> Get()
        {
            List <Item> ItemsList = new List <Item>();

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                ItemsList = myDB.Items.ToList();
            }
            return(ItemsList);

            // BuyerId = 1;
            // Item BuyerEntity;
            // List<ListItem> Items;
            // bool BuyerStatus;

            //     return BuyerList;
        }
コード例 #14
0
        public IEnumerable <RoleType> Get()
        {
            List <RoleType> RoleTypeList = new List <RoleType>();

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                RoleTypeList = myDB.RoleTypes.ToList();
            }
            return(RoleTypeList);

            // BuyerId = 1;
            // RoleType BuyerEntity;
            // List<ListItem> Items;
            // bool BuyerRoleType;

            //     return BuyerList;
        }
コード例 #15
0
        public IEnumerable <Status> Get()
        {
            List <Status> StatusList = new List <Status>();

            //Buyer temp = new Buyer();
            using (BuySellBidsContext myDB = new BuySellBidsContext())
            {
                StatusList = myDB.Statuses.ToList();
            }
            return(StatusList);

            // BuyerId = 1;
            // Status BuyerEntity;
            // List<ListItem> Items;
            // bool BuyerStatus;

            //     return BuyerList;
        }