public void Update()
 {
     if (DashboardFolder.EndsWith(@"\"))
     {
         DashboardFolder = DashboardFolder.Substring(0, DashboardFolder.Length - 1);
     }
     CheckDownloadFolder();
     Download();
     UnZip();
     Deploy();
 }
        private async Task <DashboardFolder> FetchFolderAsync(int id)
        {
            DashboardFolder list = await _context.Folders.GetAsync(id, f => f.Definitions);

            if (list != null)
            {
                list.Definitions = list.Definitions.OrderBy(o => o.Position).ToList();
            }

            return(list);
        }
        public async Task <ActionResult <DashboardFolder> > CreateFolderAsync([FromBody] DashboardFolder folder)
        {
            var folders = await _context.Folders.GetAsync();

            PositionAdjuster.AdjustForCreate(folder, folders.ToList <ISortable>(), folder.Definitions.ToList <ISortable>());

            await _context.Folders.AddAsync(folder);

            await _context.SaveChangesAsync();

            return(CreatedAtRoute("GetFolder", new { id = folder.Id }, folder));
        }
        public async Task <ActionResult <DashboardFolder> > UpdateFolderAsync(int id, [FromBody] DashboardFolder folder)
        {
            var current = await FetchFolderAsync(id);

            if (current == null)
            {
                return(NotFound());
            }

            var folders = await _context.Folders.GetAsync();

            PositionAdjuster.AdjustForUpdate(folder, folders.ToList <ISortable>(), current, folder.Definitions.ToList <ISortable>());

            current.UpdateFrom(folder);
            _context.Folders.Update(current);
            await _context.SaveChangesAsync();

            return(current);
        }