Skip to content

Commit ac93467

Browse files
Fix references to objects
1 parent f6c0b86 commit ac93467

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

exercise.wwwapi/Endpoints/ExerciseEndpoints.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private static async Task<IResult> CreateUnitInModule(IRepository<Module> module
164164
return TypedResults.NotFound();
165165
}
166166

167-
var newUnit = new Unit { ModuleId = id, Name = name, Module = module };
167+
var newUnit = new Unit { ModuleId = id, Name = name };
168168

169169
unitRepository.Insert(newUnit);
170170
await unitRepository.SaveAsync();
@@ -264,7 +264,7 @@ private static async Task<IResult> CreateExerciseInUnit(
264264
return TypedResults.NotFound();
265265
}
266266

267-
var newExercise = new Exercise { UnitId = id, Name = exerciseDTO.Name, GitHubLink = exerciseDTO.GitHubLink, Description = exerciseDTO.Description, Unit = unit };
267+
var newExercise = new Exercise { UnitId = id, Name = exerciseDTO.Name, GitHubLink = exerciseDTO.GitHubLink, Description = exerciseDTO.Description };
268268
exerciseRepository.Insert(newExercise);
269269
await exerciseRepository.SaveAsync();
270270

@@ -343,8 +343,6 @@ private static async Task<IResult> UpdateExerciseById(IRepository<Exercise> exer
343343
response.Description = exerciseDTO.Description;
344344
response.GitHubLink = exerciseDTO.GitHubLink;
345345
response.UnitId = exerciseDTO.UnitId;
346-
response.Unit = unit;
347-
348346

349347
exerciseRepository.Update(response);
350348
await exerciseRepository.SaveAsync();

0 commit comments

Comments
 (0)