public IActionResult Add(DeviationsViewModel addDeviationViewModel)
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            addDeviationViewModel.InputDeviation.userId = userId;

            if (ModelState.IsValid)
            {
                try
                {
                    _service.AddDeviation(addDeviationViewModel.InputDeviation);
                    return(RedirectToAction(nameof(Index)));
                }
                catch (Exception ex)
                {
                    ViewData["ErrorMessage"] = ex.Message;
                    ViewData["Prompt"]       = "Contact your manager.";
                    return(View("ErrorPage"));
                }
            }

            var deviationTypes = _service.GetAllDeviationTypes();

            addDeviationViewModel.SelectDaysInMonth = GetAllDaysInMonthAndYear(addDeviationViewModel.InputDeviation.RequestedDate.Year, addDeviationViewModel.InputDeviation.RequestedDate.Month);
            addDeviationViewModel.SelectDeviations  = GetDeviationTypesToSelectList(deviationTypes);

            return(View("AddDeviation", addDeviationViewModel));
        }
        public IActionResult Add(string year, string month, int monthId)
        {
            var addDeviationViewModel = new DeviationsViewModel()
            {
                InputDeviation = new DeviationDto()
            };

            addDeviationViewModel.InputDeviation.RequestedDate = DateTime.Parse($"{year}/{month}/01");
            var deviationTypes = _service.GetAllDeviationTypes();

            addDeviationViewModel.SelectDaysInMonth          = GetAllDaysInMonthAndYear(addDeviationViewModel.InputDeviation.RequestedDate.Year, addDeviationViewModel.InputDeviation.RequestedDate.Month);
            addDeviationViewModel.SelectDeviations           = GetDeviationTypesToSelectList(deviationTypes);
            addDeviationViewModel.InputDeviation.WorkMonthId = monthId;

            return(View("AddDeviation", addDeviationViewModel));
        }