public async Task GetCustomerTest()
        {
            MerchandiseService merchandiseService = new MerchandiseService();
            MerchandiseDto     merchandiseDto     = new MerchandiseDto("0", "Jajao", "Produkt wiejski", ArticleType.GROCERIES.ToString(), ArticleUnit.PACK.ToString(), 13.20, 0.01);
            await merchandiseService.SaveMerchandise(merchandiseDto);

            MerchandiseDto gotMerchandiseDto = await merchandiseService.GetMerchandise("0");

            Assert.IsNotNull(gotMerchandiseDto);
        }
        public async Task SaveCustomerTest()
        {
            MerchandiseService merchandiseService = new MerchandiseService();
            MerchandiseDto     merchandiseDto     = new MerchandiseDto("0", "Jajao", "Produkt wiejski", ArticleType.GROCERIES.ToString(), ArticleUnit.PACK.ToString(), 13.20, 0.01);
            await merchandiseService.SaveMerchandise(merchandiseDto);

            List <MerchandiseDto> gotMerchandiseDtos = (await merchandiseService.GetMerchandises()).ToList();

            Assert.AreEqual(1, gotMerchandiseDtos.Count());
        }
Esempio n. 3
0
 public async Task UpdateMerchandise(MerchandiseDto merchandise)
 {
     await Task.Factory.StartNew(() =>
     {
         lock (m_SyncObject)
         {
             Merchandise merchandiseToSet = merchandise.FromDto();
             _merchandiseRepository.Update(merchandiseToSet.Id, merchandiseToSet);
         }
     });
 }
Esempio n. 4
0
 public static MerchandiseModel FromDto(this MerchandiseDto merchandiseDto)
 {
     return(new MerchandiseModel
            (
                merchandiseDto.Id,
                merchandiseDto.Name,
                merchandiseDto.Description,
                merchandiseDto.Type,
                merchandiseDto.Unit,
                merchandiseDto.NettoPrice,
                merchandiseDto.Vat
            ));
 }
Esempio n. 5
0
 public static Product FromDto(this MerchandiseDto merchandiseDto)
 {
     return(new Product
            (
                merchandiseDto.Id,
                merchandiseDto.Name,
                merchandiseDto.Description,
                merchandiseDto.Type,
                merchandiseDto.Unit,
                merchandiseDto.NettoPrice,
                merchandiseDto.Vat
            ));
 }
Esempio n. 6
0
        public static Merchandise FromDto(this MerchandiseDto merchandiseDto)
        {
            Enum.TryParse(merchandiseDto.Type, out ArticleType type);
            Enum.TryParse(merchandiseDto.Unit, out ArticleUnit unit);

            return(new Merchandise
                   (
                       merchandiseDto.Id,
                       merchandiseDto.Name,
                       merchandiseDto.Description,
                       type,
                       unit,
                       merchandiseDto.NettoPrice,
                       merchandiseDto.Vat
                   ));
        }
Esempio n. 7
0
        public static EntryDto ToDto(this Entry entry)
        {
            MerchandiseDto merchandiseDto = new MerchandiseDto
                                            (
                entry.Code,
                entry.Name,
                entry.Description,
                entry.Type,
                entry.Unit,
                entry.NettoPrice,
                entry.Vat
                                            );

            return(new EntryDto
                   (
                       entry.Id,
                       merchandiseDto,
                       entry.Amount,
                       entry.BruttoPrice,
                       entry.Amount * entry.BruttoPrice
                   ));
        }