Пример #1
0
        public async Task <ActionResult <double> > CalculatePrice(CustomOrderDTO customOrderDTO)
        {
            var volume = await _modelVolumeRepository.getModelVolume(customOrderDTO.modelId);

            var email = HttpContext.User?.Claims?.FirstOrDefault(x => x.Type == ClaimTypes.Email)?.Value;
            var user  = await _userManager.FindByEmailAsync(email);

            if (volume == -1)
            {
                string folder   = Path.Combine(_webHostEnvironment.WebRootPath, "customusermodels", user.Id);
                string fileName = customOrderDTO.modelId;
                string filePath = Path.Combine(folder, fileName);
                volume = await _priceCalculatorService.getModelVolume(filePath);

                await _modelVolumeRepository.addModelVolume(new ModelVolumes
                {
                    Id     = customOrderDTO.modelId,
                    Volume = volume
                });
            }


            var price = await _priceCalculatorService.
                        calculatePrice(volume, customOrderDTO.FilamentId, customOrderDTO.fillingPercent);

            Console.WriteLine("OTO CENA:");
            Console.WriteLine(price);
            return(price);
        }
Пример #2
0
 public CustomOrderVM(CustomOrderDTO row)
 {
     Id              = row.Id;
     Email           = row.Email;
     DeliveryAddress = row.DeliveryAddress;
     ImageLink       = row.ImageLink;
     Garment         = row.Garment;
 }