Example #1
0
        public void PopulateModel(Map map)
        {
            map.Name        = nameInput.Value;
            map.Price       = Convert.ToDouble(priceInput.Value);
            map.Description = descriptionInput.Value;
            map.Image       = imageInputBase64.Value;
            map.Category.Id = Convert.ToInt32(dropCategoryInput.SelectedValue);

            if (resourceInput.HasFile)
            {
                string fileName = DateTime.Now.Ticks + resourceInput.FileName;
                string path     = ConfigurationManager.AppSettings["MAP_PATH"];
                UtilsHelper.CreateDirectory(path);
                resourceInput.PostedFile.SaveAs(path + "/" + fileName);
                map.Resource = fileName;
            }
        }
Example #2
0
        public List <Backup> Get()
        {
            List <Backup> backups = new List <Backup>();

            string path = ConfigurationManager.AppSettings["BACKUP_PATH"];

            UtilsHelper.CreateDirectory(path);

            DirectoryInfo Dir = new DirectoryInfo(path);

            FileInfo[] FileList = Dir.GetFiles("*.bkp", SearchOption.AllDirectories);
            foreach (FileInfo backupFile in FileList)
            {
                backups.Add(new Backup(backupFile.Name, backupFile.FullName, backupFile.Length, backupFile.CreationTime));
            }

            return(backups);
        }