コード例 #1
0
        public async Task <IActionResult> Index(ImageIndexModel model)
        {
            var location = FileUploader.ProcessFormFile(_azureSettings.StorageAccount, _azureSettings.StorageAccountPassword, model.File, "images", ModelState).Result.ToString();

            _handler.Upsert(new ImageModel()
            {
                Name = model.Name, Location = location
            });
            return(RedirectToAction(nameof(Index)));
        }
コード例 #2
0
        public async Task <IActionResult> Index(DocumentIndexModel model)
        {
            var title    = $"{ViewData["Title"]} - {model.Category}".Replace(" ", "");
            var location = FileUploader.ProcessFormFile(_azureSettings.StorageAccount, _azureSettings.StorageAccountPassword,
                                                        model.File, "documents", ModelState, title, true).Result.ToString();

            _handler.Upsert(
                new DocumentModel()
            {
                Location        = location,
                Type            = Document.DocType.FromFileName(location),
                Category        = model.Category,
                DeleteAllOthers = true
            }
                );

            return(RedirectToAction(nameof(Index)));
        }