Compare commits

..

No commits in common. "ead74b7cffa8c78c84f626c2a2596ca63561185b" and "573c12fe30426b742d17bf6ae320e31d5b73aadc" have entirely different histories.

3 changed files with 13 additions and 23 deletions

25
.vscode/tasks.json vendored
View file

@ -13,17 +13,16 @@
"isBackground": true
},
{
"label": "test blogs backend",
"label": "build-web",
"type": "process",
"problemMatcher": ["$msCompile"],
"command": "dotnet",
"args": ["test"],
"args": ["build"],
"options": {
"cwd": "src/Yavsc.Blogs.Tests"
"cwd": "src/Yavsc.Org"
},
"group": {
"kind": "test",
"isDefault": false
"kind": "build"
}
},
{
@ -41,23 +40,17 @@
"isBackground": true
},
{
"label": "test blogs",
"label": "build-web",
"type": "process",
"problemMatcher": ["$msCompile"],
"command": "dotnet",
"args": ["test"],
"runOptions": {
"instanceLimit": 1
},
"args": ["build"],
"runOptions": {},
"options": {
"cwd": "src/Yavsc.Blogs",
"env": {
"DOTNET_CLI_UI_LANGUAGE": "en-US",
"ASPNETCORE_ENVIRONMENT": "Development"
}
"cwd": "src/Yavsc.Web"
},
"group": {
"kind": "test"
"kind": "build"
},
"isBackground": true,
"presentation": {

View file

@ -114,8 +114,7 @@ namespace Yavsc.Blogs.Controllers
var files = Request.HasFormContentType
? Request.Form.Files
: (IFormFileCollection)new FormFileCollection();
var uid = User.GetUserId();
var post = blogSpotService.Create(uid, blog, files);
var post = blogSpotService.Create(User.GetUserId(), blog, files);
return CreatedAtRoute("GetBlog", new { id = post.Id }, post);
}

View file

@ -29,8 +29,6 @@ public class BlogSpotService
public BlogPost Create(string userId, BlogPost post, IFormFileCollection files)
{
// Sauvegarder le post d'abord pour obtenir son ID
// Le créateur vient de l'authentification, donc on ne le prend pas du post
post.AuthorId = userId;
_context.BlogSpot.Add(post);
_context.SaveChanges(userId);