Ejemplo n.º 1
0
 public RecordMetadata(string key, string?value, Guid record)
 {
     this.Key    = key;
     this.Value  = value;
     this.Record = record;
     this.Guid   = GuidCreator.Create(this.Record, this.Key);
 }
        public static string Add(IFormFile imageFile, string defaultPath, string defaultFile)
        {
            if (imageFile != null && imageFile.Length > 0)
            {
                string path          = @"wwwroot/" + defaultPath;
                string guidImageName = GuidCreator.Create(imageFile.FileName);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }


                using (FileStream fileStream = System.IO.File.Create(path + guidImageName))
                {
                    imageFile.CopyTo(fileStream);
                    fileStream.Flush();
                }
                return(defaultPath + guidImageName);
            }
            else
            {
                return(defaultPath + defaultFile);
            }
        }