public IEnumerable <ThingDTO> Get() { List <ThingDTO> l = new List <ThingDTO>(); foreach (Thing t in modelloDatiDbContext.Things) { l.Add(ThingConverter.convertToDto(t)); } return(l); }
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)); }
public ThingDTO Get(int id) { Thing t = modelloDatiDbContext.Things.Find(id); return(ThingConverter.convertToDto(t)); }