public override int AddNewItem(Video video) { var itemInput = new GetItemByIdInput(); var barcodeInput = new SetItemBarcodeInput(); var updateInput = new UpdateItemInput(); var input = new VideoDto.AddNewVideoInput { Video = new VideoDto(video) }; using (var repo = new VideoRepository()) { var app = new VideoAppService(repo); itemInput.Id = app.AddNewVideo(input).Id; } using (var itemRepo = new ItemRepository()) { var app = new ItemAppService(itemRepo); var thisItem = app.GetItemById(itemInput); barcodeInput.Item = thisItem.Item; var barcodeOutput = app.SetItemBarcode(barcodeInput); thisItem.Item.Barcode = barcodeOutput.Barcode; updateInput.Item = thisItem.Item; app.UpdateItem(updateInput); } return(itemInput.Id); }
public override int AddNewItem(Book book) { var itemInput = new GetItemByIdInput(); var barcodeInput = new SetItemBarcodeInput(); var updateInput = new UpdateItemInput(); var input = new AddNewBookInput { Book = new BookDto(book) }; using (var repo = new BookRepository()) { var app = new BookAppService(repo); itemInput.Id = app.AddNewBook(input).Id; } using (var itemRepo = new ItemRepository()) { var app = new ItemAppService(itemRepo); var thisItem = app.GetItemById(itemInput); barcodeInput.Item = thisItem.Item; var barcodeOutput = app.SetItemBarcode(barcodeInput); thisItem.Item.Barcode = barcodeOutput.Barcode; updateInput.Item = thisItem.Item; app.UpdateItem(updateInput); } return(itemInput.Id); }
public virtual int AddNewItem(T genericItem) { var itemInput = new GetItemByIdInput(); var barcodeInput = new SetItemBarcodeInput(); var updateInput = new UpdateItemInput(); var input = new AddNewItemInput <T> { Item = new GenericItemDto <T>(genericItem) }; using (var repo = new GenericItemRepositoryBase <T>()) { var app = new GenericItemAppService <T>(repo); itemInput.Id = app.AddNewItem(input).Id; } using (var itemRepo = new ItemRepository()) { var app = new ItemAppService(itemRepo); var thisItem = app.GetItemById(itemInput); barcodeInput.Item = thisItem.Item; var barcodeOutput = app.SetItemBarcode(barcodeInput); thisItem.Item.Barcode = barcodeOutput.Barcode; updateInput.Item = thisItem.Item; app.UpdateItem(updateInput); } return(itemInput.Id); }
public Item GetItemById(int id) { var input = new GetItemByIdInput { Id = id }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.GetItemById(input); return(output.Item.ConvertToItem()); } }