コード例 #1
0
        public async Task <IActionResult> FolderDirectoryDetails(Guid ID, Guid FolderID, bool Success = false)
        {
            try
            {
                FolderDirectoryDetailsViewModel model = new FolderDirectoryDetailsViewModel();
                model._context          = _context;
                model.FolderID          = FolderID;
                model.FolderDirectoryID = ID;
                model._user             = User;
                await model.PopulateDetails();

                await model.PopulateLists();

                ViewData.Model = model;
            }
            catch (Exception ex)
            {
                HelperFunctions.Log(_context, PublicEnums.LogLevel.LEVEL_EXCEPTION, "Controllers.FileShareController.FolderDirectoryDetails", ex.Message, User, ex);
                ViewBag.Error = "An error occurred. Please try again later.";
            }

            //Set message if redirected from save
            if (Success)
            {
                ViewBag.Success = "Folder directory updated successfully";
            }

            return(View());
        }
コード例 #2
0
        public async Task <IActionResult> FolderDirectoryDetails(FolderDirectoryDetailsViewModel model)
        {
            model._context         = _context;
            model._securityOptions = _securityOptions;
            model._emailService    = _emailService;
            model._user            = User;

            try
            {
                if (ModelState.IsValid)
                {
                    Guid folderDirectoryID = Guid.Empty;

                    folderDirectoryID = await model.Save();

                    if (folderDirectoryID != Guid.Empty)
                    {
                        return(RedirectToAction("FolderDirectoryDetails", new { ID = folderDirectoryID, FolderID = model.FolderID, Success = true }));
                    }
                    else
                    {
                        ViewBag.Error = model.errorMessage;
                    }
                }
                else
                {
                    ViewBag.Error = "Please make sure the required fields are added";
                }
            }
            catch (Exception ex)
            {
                HelperFunctions.Log(_context, PublicEnums.LogLevel.LEVEL_EXCEPTION, "Controllers.FileShareController.FolderDirectoryDetails", ex.Message, User, ex);
                ViewBag.Error = "An error occurred. Please try again later.";
            }
            finally
            {
                await model.PopulateLists();
            }
            return(View(model));
        }