public async Task <ItemDto[]> SearchAsync( [FromQuery] string keywords = "", [FromQuery] int skipCount = 0, [FromQuery] int maxResultCount = 10) { return(await ItemAppService.SearchAsync(keywords)); }
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 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 async Task <ItemDto[]> GetList( string keywords = null, int seed = 0, int skipCount = 0, int maxResultCount = 10, int[] itemIdsArr = null) { if (seed < 0 || skipCount < 0 || maxResultCount < 0) { throw new ArgumentException(); } if (itemIdsArr != null && itemIdsArr.Length > 0) { return(await ItemAppService.GetItemsWithDetailAsync(itemIdsArr)); } else if (keywords == null) { return(await ItemAppService.SelectAsync(seed, maxResultCount)); } else { return(await ItemAppService.SearchAsync(keywords, skipCount, maxResultCount)); } }
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 List <Item> QueryItemsThatAreVideos() { using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.QueryItemsThatAreVideos(); return(output.Items.Select(i => i.ConvertToItem()).ToList()); } }
public IEnumerable <Item> GetAllItems() { using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.GetAllItems(); return(output.Items.Select(i => i.ConvertToItem()).ToList()); } }
public async Task UpdateItemCategory([FromRoute] int id, [FromBody] ItemCategoryDto[] dtosArr) { var idsList = new List <int>(); foreach (var dto in dtosArr) { idsList.Add(dto.CategoryID); } await ItemAppService.UpdateItemCategory(id, idsList.ToArray()); }
public IActionResult PutMidia(string id, [FromBody] MidiaDTO midia) { try { ItemAppService.AlterarMidia(id, midia); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult PutLivro(string id, [FromBody] LivroDTO livro) { try { ItemAppService.AlterarLivro(id, livro); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult PostMidia([FromBody] MidiaDTO midia) { try { ItemAppService.InserirMidia(midia); return(Created(String.Empty, midia)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult PostLivro([FromBody] LivroDTO livro) { try { ItemAppService.InserirLivro(livro); return(Created(String.Empty, livro)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult PostEmprestimo([FromBody] EmprestimoDTO emprestimo) { try { ItemAppService.Emprestar(emprestimo); return(Created(String.Empty, emprestimo)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult DeleteMidia(string id) { try { ItemAppService.ExcluirMidia(id); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult PutDevolucao(string id) { try { ItemAppService.Devolver(id); return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void DeleteItemById(int id) { var input = new DeleteItemByIdInput { Id = id }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); app.DeleteItemById(input); } }
public List <Item> GetItemsByPartOfBarcode(string barcode) { var input = new GetItemsByPartOfBarcodeInput { Barcode = barcode }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.GetItemsByPartOfBarcode(input); return(output.Items.Select(i => i.ConvertToItem()).ToList()); } }
public int UpdateItem(Item updatedItem) { var input = new UpdateItemInput { Item = new ItemDto(updatedItem) }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.UpdateItem(input); return(output.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()); } }
public string SetItemBarcode(Item item) { var input = new SetItemBarcodeInput { Item = new ItemDto(item) }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.SetItemBarcode(input); return(output.Barcode); } }
public List <Item> GetItemsByConsignorName(string firstName, string lastName) { var input = new GetItemsByConsignorNameInput { FirstName = firstName, LastName = lastName }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.GetItemsByConsignorName(input); return(output.Items.Select(i => i.ConvertToItem()).ToList()); } }
public IEnumerable <Item> SearchAllItems(string barcode, string status, string itemType, string consignorName, DateTime?listedDate) { var input = new SearchAllItemsInput { Barcode = barcode, Status = status, ItemType = itemType, ConsignorName = consignorName, ListedDate = listedDate }; using (var repo = new ItemRepository()) { var app = new ItemAppService(repo); var output = app.SearchAllItems(input); return(output.Items.Select(i => i.ConvertToItem()).ToList()); } }
public IActionResult GetLivro(string id) { try { var retorno = ItemAppService.ObterLivro(id); if (retorno != null) { return(Ok(retorno)); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IActionResult GetLivros() { try { var retorno = ItemAppService.ObterLivros(); if (retorno.Count() > 0) { return(Ok(retorno)); } else { return(NotFound()); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task Delete([FromRoute] int id) { await ItemAppService.DeleteAsync(id); }
public async Task <ItemDto> Update([FromRoute] int id, [FromBody] ItemUpdateDto dto) { return(await ItemAppService.UpdateAsync(id, dto)); }
public async Task <ItemDto> Create([FromBody] ItemCreateDto dto) { return(await ItemAppService.CreateAsync(dto)); }
public async Task <ItemDto> Get([FromRoute] int id) { return(await ItemAppService.GetAsync(id)); }
public async Task DeleteItemPic([FromRoute] int id, [FromRoute] string filename) { await ItemAppService.RemoveItemPic(filename); }
public async Task <BlobFileDto> AddItemPic([FromRoute] int id, [FromBody] BlobFileDto dto) { return(await ItemAppService.AddItemPic(id, dto)); }