public async Task <ActionResult> GetIntervalByEmployeeId(int employeeid) { try { this._logger.Information($"Start {nameof(GetIntervalByEmployeeId)} employeeid = {employeeid}"); IEnumerable <Duty> dutyList = await _plinovodiDutyDataRead.GetEmployeeDuties(employeeid); List <Interval> dutyInterval = new List <Interval>(); foreach (Duty duty in dutyList) { dutyInterval.Add(new Interval { Id = duty.Id, Obdobje = duty.From.ToString("d.M.yyyy HH:mm") + " - " + duty.To.ToString("d.M.yyyy HH:mm"), Disabled = DateTime.Now < duty.From }); } this._logger.Information($"End {nameof(GetIntervalByEmployeeId)}"); return(Json(dutyInterval)); } catch (Exception ex) { this._logger.Error($"Error {nameof(GetIntervalByEmployeeId)} {ex.Message} {ex.StackTrace}"); throw ex; } }
public async Task <ViewResult> Index() { try { this._logger.Information($"Start {nameof(Index)}"); ISession session = _services.GetRequiredService <IHttpContextAccessor>()?.HttpContext.Session; SessionLogIn ses = session.GetJson <SessionLogIn>("ses"); IEnumerable <Duty> dutyList = await _plinovodiDutyDataRead.GetEmployeeDuties(ses.EmployeeId); this._logger.Information($"End {nameof(Index)}"); return(View(dutyList)); } catch (Exception ex) { this._logger.Error($"Error {nameof(Index)} {ex.Message} {ex.StackTrace}"); throw ex; } }