private async Task <string> SaveImg(IFormFile formFile)
        {
            var bytes = await formFile.ConvertToByteArray();


            return(await fileStorage.SaveFile(bytes, Path.GetExtension(formFile.FileName), ApplicationConstants.ImageContainerNames.GroupImagesContainer, formFile.ContentType, Guid.NewGuid().ToString()));
        }
        private async Task <string> SaveIcon(IFormFile icon)
        {
            var content = await icon.ConvertToByteArray();

            string iconPath = await fileStorage.SaveFile(content, Path.GetExtension(icon.FileName), ApplicationConstants.ImageContainerNames.SocialNetworkIconContainer, icon.ContentType, Guid.NewGuid().ToString());

            return(iconPath);
        }
        private async Task <string> SaveIcon(IFormFile sponsorIcon)
        {
            var bytes = await sponsorIcon.ConvertToByteArray();

            return(await fileStorage.SaveFile(bytes,
                                              Path.GetExtension(sponsorIcon.FileName),
                                              ApplicationConstants.ImageContainerNames.AreaContainer,
                                              sponsorIcon.ContentType, Guid.NewGuid().ToString()));
        }
예제 #4
0
        public async Task <ActionResult <string> > GetQRCodeContent(IFormFile file)
        {
            if (file == null || file.Length <= 0)
            {
                return(Problem("File is empty"));
            }

            if (!Path.GetExtension(file.FileName).Equals(".jpg", StringComparison.OrdinalIgnoreCase))
            {
                return(UnprocessableEntity("Not Support file extension"));
            }
            string serealizedJson = string.Empty;

            try
            {
                serealizedJson = await Upload(file.ConvertToByteArray(), file.FileName);

                return(GetDesearelizedResult(serealizedJson));
            }
            catch (Exception e)
            {
                return(UnprocessableEntity($"{serealizedJson} {Environment.NewLine} {e.Message} "));
            }
        }