Fixed errors

This commit is contained in:
JakubWalkowiak 2021-01-04 23:40:14 +01:00
parent 90e980be98
commit 76085be47d
7 changed files with 6 additions and 1 deletions

Binary file not shown.

View File

@ -40,7 +40,11 @@ namespace StudyLib.API.Controllers
return NotFound(); return NotFound();
} }
subject.EditedBy = userId; if (subject.EditedBy == null)
{
subject.EditedBy = userId;
}
_context.Entry(subject).State = EntityState.Modified; _context.Entry(subject).State = EntityState.Modified;
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -55,6 +59,7 @@ namespace StudyLib.API.Controllers
return BadRequest(); return BadRequest();
} }
subject.EditedBy = null;
_context.Entry(subject).State = EntityState.Modified; _context.Entry(subject).State = EntityState.Modified;
foreach (var comment in subject.Comments) foreach (var comment in subject.Comments)
{ {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.