Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tsi1-backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rodrigo Sastre Marotta
tsi1-backend
Merge requests
!15
Feature/upload file
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature/upload file
feature/upload-file
into
develop
Overview
0
Commits
7
Pipelines
0
Changes
9
Merged
Enzo Santangelo Dodera
requested to merge
feature/upload-file
into
develop
4 years ago
Overview
0
Commits
7
Pipelines
0
Changes
9
Expand
0
0
Merge request reports
Viewing commit
5948f2f4
Prev
Next
Show latest version
9 files
+
67
−
11
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
9
Search (e.g. *.vue) (Ctrl+P)
5948f2f4
add create and delete folders
· 5948f2f4
esantangelo
authored
4 years ago
Tsi1.Api/Tsi1.Api/Controllers/CourseController.cs
+
14
−
2
Options
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Security.Claims
;
using
System.Threading.Tasks
;
@@ -19,9 +20,12 @@ namespace Tsi1.Api.Controllers
{
private
readonly
ICourseService
_courseService
;
public
CourseController
(
ICourseService
courseService
)
private
readonly
IFileService
_fileService
;
public
CourseController
(
ICourseService
courseService
,
IFileService
fileService
)
{
_courseService
=
courseService
;
_fileService
=
fileService
;
}
[
Authorize
(
Roles
=
UserTypes
.
Student
+
", "
+
UserTypes
.
Professor
)]
@@ -54,6 +58,10 @@ namespace Tsi1.Api.Controllers
return
BadRequest
(
result
.
Message
);
}
var
path
=
Path
.
Combine
(
tenantId
.
ToString
(),
result
.
Data
.
Id
.
ToString
());
_fileService
.
CreateFolder
(
path
);
return
Ok
();
}
@@ -197,11 +205,15 @@ namespace Tsi1.Api.Controllers
return
BadRequest
(
result
.
Message
);
}
if
(
result
.
Data
==
false
)
if
(
result
.
Data
==
null
)
{
return
NotFound
(
result
.
Message
);
}
var
path
=
Path
.
Combine
(
result
.
Data
.
TenantId
.
ToString
(),
result
.
Data
.
Id
.
ToString
());
_fileService
.
DeleteFolder
(
path
);
return
Ok
();
}
Loading