public async Task <IActionResult> Portal(bool isExist = false, bool isOutExist = false, bool isFail = false, bool isEnd = false) { string user = User.FindFirst("Index").Value; var Currentuser = await _taskRepository.GetCurrentUser(user); ViewBag.photo = Currentuser.PhotoURL; int EmpId = Currentuser.EmpId; await _timeTrackRepo.LoggedIn(EmpId); await _taskRepository.LoggedIn(EmpId); await _taskRepository.TimeSEmail(EmpId); await _timeTrackRepo.AttendenceEmail(EmpId); if (Currentuser.JobType == "project manager") { await _repo4.EmailProjectStatus(EmpId); } ViewBag.EmpId = EmpId; bool result = _timeTrackRepo.CheckExist(EmpId); if (result == true) { ViewBag.EndBreak = isEnd; var data = await _timeTrackRepo.GetTime(EmpId); ViewBag.Status = data.Status; bool check = _timeTrackRepo.CheckOut(EmpId); Double dc2 = Math.Round((Double)data.BreakingHours, 2); if (check == true) { TimeSpan differ = (TimeSpan)(DateTime.Now - data.InTime); Double dc = Math.Round((Double)differ.TotalHours, 2); Double dc3 = Math.Round((Double)(dc - dc2), 2); var timeSpan = TimeSpan.FromHours(dc3); int hh = timeSpan.Hours; int mm = timeSpan.Minutes; ViewBag.Work = hh + "h " + mm + " min"; ViewBag.Out = "Not been enterd"; if (data.Status == "Break") { ViewBag.StartBreak = "Break"; } else { ViewBag.StartBreak = "Work"; } } else { TimeSpan differ = (TimeSpan)(data.OutTime - data.InTime); Double dc = Math.Round((Double)differ.TotalHours, 2); Double dc3 = Math.Round((Double)(dc - dc2), 2); var timeSpan = TimeSpan.FromHours(dc3); int hh = timeSpan.Hours; int mm = timeSpan.Minutes; ViewBag.Work = hh + "h " + mm + " min"; ViewBag.Out = data.OutTime.ToString("hh:mm tt"); } ViewBag.Track = data.TrackId; Double brk = Math.Round((Double)data.BreakingHours, 2); var timeSpan1 = TimeSpan.FromHours(brk); int hh1 = timeSpan1.Hours; int mm1 = timeSpan1.Minutes; ViewBag.Break = hh1 + " h " + mm1 + " minutes"; ViewBag.In = data.InTime.ToString("hh:mm tt"); ViewBag.IsExist = isExist; ViewBag.IsFail = false; ViewBag.IsOutExist = isOutExist; return(View(data)); } else { ViewBag.Track = 0; ViewBag.Work = 0; ViewBag.Break = 0; ViewBag.In = "Not been enterd"; ViewBag.Out = "Not been enterd"; ViewBag.IsFail = isFail; ViewBag.Status = "Not mark In-time"; return(View()); } }