Beispiel #1
0
        public IEnumerable <ThingDTO> Get()
        {
            List <ThingDTO> l = new List <ThingDTO>();

            foreach (Thing t in modelloDatiDbContext.Things)
            {
                l.Add(ThingConverter.convertToDto(t));
            }

            return(l);
        }
Beispiel #2
0
        public ThingDTO Modifica(int id, String num_Uscite, double prezzo, int customerID, int buildingID)
        {
            Thing thing = new Thing();

            foreach (Thing t in modelloDatiDbContext.Things)
            {
                if (t.ThingID == id)
                {
                    thing            = modelloDatiDbContext.Things.Where(tt => tt.ThingID == id).FirstOrDefault();
                    thing.Num_Uscite = num_Uscite;
                    thing.Prezzo     = prezzo;
                    thing.Customer   = modelloDatiDbContext.Customers.Find(customerID);
                    thing.Building   = modelloDatiDbContext.Buildings.Find(buildingID);
                }
            }
            modelloDatiDbContext.SaveChanges();
            return(ThingConverter.convertToDto(thing));
        }
Beispiel #3
0
        public ThingDTO Get(int id)
        {
            Thing t = modelloDatiDbContext.Things.Find(id);

            return(ThingConverter.convertToDto(t));
        }