Exemplo n.º 1
0
        public IActionResult Index()
        {
            var manage = new ManagerBll();
            var list   = manage.GetAllPictureInfo();

            return(View("Manager", list));
        }
Exemplo n.º 2
0
        public IActionResult Index()
        {
            var mana   = new ManagerBll();
            var picLst = mana.GetAllPictureInfo();

            return(View(picLst));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> AddInstance(IEnumerable <IFormFile> files)
        {
            var  dbList = new List <PictureResourceInfo>();
            long size   = files.Sum(f => f.Length);

            foreach (var formFile in files)
            {
                if (formFile.Length > 0)
                {
                    var filePath = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\ImgSavePath", formFile.FileName);
                    using (var stream = System.IO.File.Create(filePath))
                    {
                        await formFile.CopyToAsync(stream);
                    }
                    dbList.Add(new PictureResourceInfo()
                    {
                        SavePath   = filePath,
                        DispPath   = $"/ImgSavePath/{formFile.FileName}",
                        Descrition = $"存储位置{filePath}",
                        GId        = Guid.NewGuid(),
                        CreateTime = DateTime.Now,
                        CreateBy   = $"Test"
                    });
                }
            }
            var manage = new ManagerBll();

            manage.AddPictureInfo(dbList);
            // Process uploaded files
            // Don't rely on or trust the FileName property without validation.

            // return Ok(new { count = files.Count, size });

            var list = manage.GetAllPictureInfo();

            return(View("Manager", list));
        }