public EditGoodsReceivedNoteFreeItemDtoValidatorFixture() { Validator = new EditGoodsReceivedNoteFreeItemDtoValidator(); Model = new EditGoodsReceivedNoteFreeItemDto { GoodsReceivedNoteId = 1, ItemId = 1, ItemUnitPrice = 1450.50m, Quantity = 2, Nbt = 0.3m, Vat = 0.5m, Discount = 1.2m, }; }
public async Task <GetGoodsReceivedNoteFreeItemDto> UpdateGoodsReceivedNoteFreeItemAsync(long id, EditGoodsReceivedNoteFreeItemDto goodsReceivedNoteFreeItemDto) { var item = await GetGoodsReceivedNoteFreeItemById(id); await CheckGoodsReceivedNoteFreeItemAsync(id, goodsReceivedNoteFreeItemDto.GoodsReceivedNoteId, goodsReceivedNoteFreeItemDto.ItemId); item = _mapper.Map(goodsReceivedNoteFreeItemDto, item); await _goodsReceivedNoteFreeItem.UpdateGoodsReceivedNoteFreeItemAsync(item); return(_mapper.Map <GetGoodsReceivedNoteFreeItemDto>(item)); }
public GoodsReceivedNoteFreeItemControllerFixture() { ApiVersion = new ApiVersion(1, 0); MockGoodsReceivedNoteFreeItemRepository = new Mock <IGoodsReceivedNoteFreeItemRepository>(); GoodsReceivedNoteFreeItems = new List <GetGoodsReceivedNoteFreeItemDto> { new GetGoodsReceivedNoteFreeItemDto { Id = 1, GoodsReceivedNoteId = 101, ItemTypeId = 6, ItemTypeName = "Bevarage", ItemId = 20052, ItemName = "Coca cola", ItemUnit = 1.5m, UnitOfMeasureCode = "l", ItemUnitPrice = 250, Quantity = 1, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }, new GetGoodsReceivedNoteFreeItemDto { Id = 2, GoodsReceivedNoteId = 202, ItemTypeId = 5, ItemTypeName = "Grocery", ItemId = 20026, ItemName = "Salt", ItemUnit = 5, UnitOfMeasureCode = "kg", ItemUnitPrice = 30, Quantity = 1, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m } }; ValidCreateGoodsReceivedNoteFreeItemDto = new CreateGoodsReceivedNoteFreeItemDto { GoodsReceivedNoteId = 202, ItemId = 20023, ItemUnitPrice = 350, Quantity = 5, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }; CreateGoodsReceivedNoteFreeItemDtoResult = new GetGoodsReceivedNoteFreeItemDto { Id = 3, GoodsReceivedNoteId = 202, ItemTypeId = 5, ItemTypeName = "Grocery", ItemId = 20023, ItemName = "Rice", ItemUnit = 10, UnitOfMeasureCode = "kg", ItemUnitPrice = 350, Quantity = 1, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }; ValidEditGoodsReceivedNoteFreeItemDto = new EditGoodsReceivedNoteFreeItemDto { GoodsReceivedNoteId = 101, ItemId = 20052, ItemUnitPrice = 150, Quantity = 2 }; EditGoodsReceivedNoteFreeItemDtoResult = new GetGoodsReceivedNoteFreeItemDto { Id = 2, GoodsReceivedNoteId = 101, ItemTypeId = 5, ItemTypeName = "Bevarage", ItemId = 20052, ItemName = "Coca cola", ItemUnit = 1.5m, UnitOfMeasureCode = "l", ItemUnitPrice = 150, Quantity = 2, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }; }
public GoodsReceivedNoteFreeItemRepositoryFixture() { MockGoodsReceivedNoteFreeItemService = new Mock <IGoodsReceivedNoteFreeItemService>(); var unitOfMeasure1 = new UnitOfMeasure { Id = 1, Code = "kg", Description = "" }; var unitOfMeasure2 = new UnitOfMeasure { Id = 2, Code = "g", Description = "" }; var unitOfMeasure3 = new UnitOfMeasure { Id = 3, Code = "l", Description = "" }; var unitOfMeasure4 = new UnitOfMeasure { Id = 4, Code = "ml", Description = "" }; var unitOfMeasure5 = new UnitOfMeasure { Id = 5, Code = "none", Description = "" }; var stockType1 = new StockType { Id = 1, Type = "Grocery" }; var stockType2 = new StockType { Id = 2, Type = "Beverage" }; var stockType3 = new StockType { Id = 3, Type = "Stationery" }; var stockItems = new List <StockItem> { new StockItem { Id = 20025, TypeId = 1, Type = stockType1, Name = "Rice", ItemUnit = 10, UnitOfMeasureId = 1, UnitOfMeasure = unitOfMeasure1 }, new StockItem { Id = 20026, TypeId = 1, Type = stockType1, Name = "Chilli Powder", ItemUnit = 250, UnitOfMeasureId = 2, UnitOfMeasure = unitOfMeasure2 }, new StockItem { Id = 20050, TypeId = 2, Type = stockType2, Name = "Water", ItemUnit = 1, UnitOfMeasureId = 3, UnitOfMeasure = unitOfMeasure3 }, new StockItem { Id = 20024, TypeId = 3, Type = stockType3, Name = "Blue Pen", ItemUnit = 1, UnitOfMeasureId = 5, UnitOfMeasure = unitOfMeasure5 }, new StockItem { Id = 20023, TypeId = 5, Type = stockType1, Name = "Rice", ItemUnit = 10, UnitOfMeasureId = 1, UnitOfMeasure = unitOfMeasure1 }, }; GoodsReceivedNoteFreeItems = new List <GoodsReceivedNoteFreeItem> { new GoodsReceivedNoteFreeItem { Id = 1, GoodsReceivedNoteId = 101, ItemId = 20026, Item = stockItems.First(d => d.Id == 20026), ItemUnitPrice = 250, Quantity = 1, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }, new GoodsReceivedNoteFreeItem { Id = 2, GoodsReceivedNoteId = 202, ItemId = 20050, Item = stockItems.First(d => d.Id == 20050), ItemUnitPrice = 30, Quantity = 5, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m } }; CreateGoodsReceivedNoteFreeItemDto = new CreateGoodsReceivedNoteFreeItemDto { GoodsReceivedNoteId = 202, ItemId = 20023, ItemUnitPrice = 350, Quantity = 5, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }; CreatedNewGoodsReceivedNoteFreeItem = new GoodsReceivedNoteFreeItem { Id = 3, GoodsReceivedNoteId = 202, ItemId = 20023, Item = stockItems.First(d => d.Id == 20023), ItemUnitPrice = 350, Quantity = 5, Nbt = 0.1m, Vat = 0.1m, Discount = 0.1m }; EditGoodsReceivedNoteFreeItemDto = new EditGoodsReceivedNoteFreeItemDto { GoodsReceivedNoteId = 101, ItemId = 20026, ItemUnitPrice = 350, Quantity = 2 }; }
public async Task <IActionResult> UpdateGoodsReceivedNoteFreeItem(long id, EditGoodsReceivedNoteFreeItemDto goodsReceivedNoteFreeItemDto) { var result = await _repository.UpdateGoodsReceivedNoteFreeItemAsync(id, goodsReceivedNoteFreeItemDto); return(Ok(result)); }