public async void RequestHoliday(Employee employee, DateTime offDays)
        {
            HolidayRequests request = new HolidayRequests()
            {
                EmployeeId   = employee.Id,
                RequestedDay = offDays,
                // by default this value is unhandled
                ReqStatus = HolidayRequests.RequestStatus.UnHandled,

                // this param is gonna be available once we add permissions like
                // CanTakeHoliday perm and CanApproveHoliday perm.
                //HolidayPermissionsLevel= employee.Permission.
            };

            _context.HolidayRequests.Add(request);
            await _context.SaveChangesAsync();
        }
Пример #2
0
        public async Task <HolidayRequest> AddHolidayRequest(HolidayRequestDto request, UserManager <ApplicationUser> _userManager)
        {
            HolidayRequest holiday = HolidayFromDto(request, _userManager);

            HolidayRequests.Add(holiday);

            Task <IdentityResult> result = _userManager.UpdateAsync(this);

            if (result.Result.Succeeded)
            {
                return(holiday);
            }
            else
            {
                return(null);
            }
        }