Example #1
0
 public static UploadFileType AsDatabaseModel(UploadFileTypeViewModel model)
 {
     return(new UploadFileType()
     {
         ID = model.ID,
         Description = model.Description,
         FilesPath = model.FilesPath
     });
 }
Example #2
0
 public IActionResult AddFileType(UploadFileTypeViewModel model)
 {
     try
     {
         ExcelLoanServices.AddUploadFileType(model, _hostingEnvironment.WebRootPath);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(RedirectToAction("Index", "Error", new { ErrorMessage = ex.Message }));
     }
 }
Example #3
0
        public UploadFileTypeViewModel AddUploadFileType(UploadFileTypeViewModel model, string rootPath)
        {
            model.FilesPath = "/Files/" + model.FilesPath;
            var path = rootPath + model.FilesPath;

            if (Directory.Exists(path))
            {
                throw new Exception("ამ სახელით დირექტორია უკვე არსებობს");
            }
            else
            {
                Directory.CreateDirectory(path);
                return(Transformer.AsViewModelModel(UploadFileTypeRepository.Add(Transformer.AsDatabaseModel(model))));
            }
        }