From 21343e716b8ef68d4a0b25d7198eb74f3a9c063b Mon Sep 17 00:00:00 2001 From: Nobir Date: Wed, 20 Jul 2022 13:34:53 +0600 Subject: [PATCH] [Fixed] when user logout but the working hours table get an error because it's found more than one record so exit_time update only the last one --- Controllers/HomeController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index 772f4b3..7d427d8 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -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) {