private ThingPic AddPicFromWebCam(FileInfo img, List <string> filePaths)
        {
            var thingGuid = Guid.NewGuid().ToString();
            var pic       = new ThingPic();

            //img.Replace

            img.MoveTo(Path.Combine(_host.WebRootPath + "\\thingimages\\", thingGuid + img.Name.Substring(img.Name.Length - 5)));
            //var fileName = thingGuid + img.Name.ToString();
            var filePath = _host.WebRootPath + "\\thingimages\\" + thingGuid + img.Name.Substring(img.Name.Length - 5);

            filePaths.Add(filePath);

            pic.Pic = img.Name;
            return(pic);
        }
        private async Task <ThingPic> AddPicFromFileAsync(IFormFile file, List <string> filePaths)
        {
            var thingGuid = Guid.NewGuid().ToString();

            var pic = new ThingPic();

            var fileName = thingGuid + file.FileName.Substring(file.FileName.Length - 5);
            var filePath = _host.WebRootPath + "\\thingimages\\" + fileName;

            filePaths.Add(filePath);

            using (var stream = new FileStream(filePath, FileMode.Create))
            {
                await file.CopyToAsync(stream);
            }

            pic.Pic = fileName;

            return(pic);
        }