Example #1
0
        public async Task AddMeasurements(List <IFormFile> images)
        {
            var user = await _userManager.FindByNameAsync(this.User.Identity.Name);

            //var userProgram = _

            List <UploadImage> uploadImages = new List <UploadImage>();

            foreach (var image in images)
            {
                var uploadImage = await FormFileConverter.ConvertToUploadImageAsync(image);

                uploadImages.Add(uploadImage);
            }
        }
Example #2
0
        public async Task <int> AddMeasurementsAsync(int userId, int userProgramId, List <IFormFile> images, string type, short growth, short weight, short wrist, short hand, short breast, short waistTop, short waistMiddle, short waistBottom, short buttocks, short thighs, short leg, short kneeTop)
        {
            var measurements = new UserMeasurements
            {
                UserId        = userId,
                UserProgramId = userProgramId,
                Type          = type,
                Growth        = growth,
                Weight        = weight,
                Wrist         = wrist,
                Hand          = hand,
                Breast        = breast,
                WaistTop      = waistTop,
                WaistMiddle   = waistMiddle,
                WaistBottom   = waistBottom,
                Buttocks      = buttocks,
                Thighs        = thighs,
                Leg           = leg,
                KneeTop       = kneeTop
            };

            var measurementsId = await _measurementsManager.AddMeasurementsAsync(measurements);

            List <UploadImage> uploadImages = new List <UploadImage>();

            foreach (var image in images)
            {
                var uploadImage = await FormFileConverter.ConvertToUploadImageAsync(image);

                uploadImages.Add(uploadImage);
            }

            await _imageService.SaveImagesToDiskAsync(userId, ImageRelationType.Measurements, measurementsId, uploadImages);

            return(measurementsId);
        }