コード例 #1
0
        public async Task <IActionResult> ReturnFromVacation(VacationIndexVm model, CancellationToken cancellationToken)
        {
            TypeVacation vacation = await _vacationRepository.Entities.FirstOrDefaultAsync(c => c.Id == model.Id, cancellationToken);

            vacation.EntranceDate = DateTime.Now;
            vacation.EntranceTime = DateTime.Now.ToString("HH:mm");
            await _vacationRepository.UpdateAsync(vacation, cancellationToken);

            return(Redirect("/User/Index?Id=" + User.FindFirst(ClaimTypes.NameIdentifier).Value));
        }
コード例 #2
0
        public async Task <IActionResult> ReturnFromVacation(int Id, CancellationToken cancellationToken)
        {
            if (Id == 0)
            {
                return(NotFound());
            }
            TypeVacation vacation = await _vacationRepository.Entities.FirstOrDefaultAsync(c => c.Id == Id, cancellationToken);

            VacationIndexVm model = new VacationIndexVm
            {
                TimeOff           = vacation.TimeOff,
                Title             = vacation.Title,
                DepartureDate     = vacation.DepartureDate,
                DepartureTime     = vacation.DepartureTime,
                EntranceDate      = DateTime.Now,
                EntranceTime      = DateTime.Now.ToString("HH:mm"),
                ShowDepartureDate = vacation.DepartureDate.ToPersionDate(),
                ShowEntranceDate  = DateTime.Now.ToPersionDate(),
                ShowTimeOff       = vacation.TimeOff.ToString("HH:mm")
            };

            return(View(model));
        }