public async Task <List <int> > UploadPrintables(List <int> spoolIds) { var printables = new List <Domains.PrintableObject.PrintableObject> { new Domains.PrintableObject.PrintableObject { Id = 0, Name = "Baby Groot", PrintCost = .5, PrintTime = new TimeSpan(8, 0, 0), SellValue = 5.00, URL = "https://www.thingiverse.com/thing:2014307", PlasticSpoolId = spoolIds[0] }, new Domains.PrintableObject.PrintableObject { Id = 0, Name = "T-Rex Skull", PrintCost = .5, PrintTime = new TimeSpan(20, 0, 0), SellValue = 12.00, URL = "https://www.thingiverse.com/thing:308335", PlasticSpoolId = spoolIds[1] }, new Domains.PrintableObject.PrintableObject { Id = 0, Name = "All In One 3D Printer test", PrintCost = .5, PrintTime = new TimeSpan(1, 0, 0), SellValue = 2, URL = "https://www.thingiverse.com/thing:2656594", PlasticSpoolId = spoolIds[1] }, new Domains.PrintableObject.PrintableObject { Id = 0, Name = "Baby Yoda -like character Smiling", PrintCost = .5, PrintTime = new TimeSpan(3, 0, 0), SellValue = 2, URL = "https://www.thingiverse.com/thing:3987143", PlasticSpoolId = spoolIds[1] }, }; var printableIds = new List <int>(); foreach (var printable in printables) { printableIds.Add((await _printableRepository.Create(new PrintableObjectDto(printable))).Id); } return(printableIds); }
public async Task Create(PrintableObjectViewModel PrintableObjectViewModel) { var data = PrintableObjectViewModel.DtoModel(); if (PrintableObjectViewModel.Id == 0) { await _printableObjectService.Create(data); } if (PrintableObjectViewModel.Id != 0) { await _printableObjectService.Update(data); } }