Skip to content

Commit

Permalink
[Fixed] when user logout but the working hours table get an error bec…
Browse files Browse the repository at this point in the history
…ause it's found more than one record so exit_time update only the last one
  • Loading branch information
nobir committed Jul 20, 2022
1 parent 7213d45 commit 21343e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ActionResult Logout()
var db = new TimologioEntities();
var sessionUserId = sessionUser.Id;

var db_working_hour = db.WorkingHours.Where(w => w.UserId == sessionUserId && w.ExitTime == null).SingleOrDefault();
var db_working_hour = db.WorkingHours.Where(w => w.UserId == sessionUserId && w.ExitTime == null).ToList().LastOrDefault();

if(db_working_hour != null)
{
Expand Down

0 comments on commit 21343e7

Please sign in to comment.