Skip to content
Snippets Groups Projects
Commit 7497781d authored by Lucca Santangelo's avatar Lucca Santangelo
Browse files

close record fix

parent 96bec833
No related branches found
No related tags found
1 merge request!34bedelia
......@@ -111,10 +111,13 @@ namespace Bedelia.Controllers
public async Task<IActionResult> CloseRecord(CloseRecordDto closeRecord)
{
var now = DateTime.Now;
var courseId = await _context.Courses
.Where(x => x.Name == closeRecord.CourseName)
.Select(x => x.Id)
.FirstOrDefaultAsync();
var course = await _context.Courses
.FirstOrDefaultAsync(x => x.Name == closeRecord.CourseName);
if (course == null)
{
return BadRequest(string.Format(@"No existe el curso con nombre {0} en bedelia", closeRecord.CourseName));
}
var userIdentityCards = closeRecord.UserGrades.Select(x => x.IdentityCard);
......@@ -132,7 +135,7 @@ namespace Bedelia.Controllers
userCourses.Add(new UserCourse()
{
CourseId = courseId,
CourseId = course.Id,
UserId = user.Id,
Grade = grade,
GradeDate = now
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment