Пример #1
0
        public async Task <IActionResult> OnGet(int id)
        {
            try
            {
                var trainee = await _traineeService.GetTraineeById(id);

                if (trainee == null)
                {
                    return(NotFound());
                }

                Input = new InputModel()
                {
                    TraineeId   = trainee.TraineeId,
                    Address     = trainee.Address,
                    DoB         = trainee.DoB,
                    Email       = trainee.Email,
                    PhoneHome   = trainee.PhoneHome,
                    PhoneMobile = trainee.PhoneMobile,
                    FullName    = trainee.FullName,
                    GenderId    = trainee.GenderId,
                    Gender      = (await _genderService.GetGenders()).Select(p => SelectListFactory.Create(p))
                };

                return(Page());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
        public async Task <IActionResult> OnGetDelete(int id)
        {
            var trainee = await _traineeService.GetTraineeById(id);

            if (trainee == null)
            {
                return(NotFound());
            }
            trainee.IsDeleted = 1;

            var status = await _traineeService.Update(trainee);

            return(RedirectToPage("Index"));
        }
Пример #3
0
        public async Task <IActionResult> OnGet(int id)
        {
            var trainee = await _traineeService.GetTraineeById(id, includeDetails : true);

            Input = new InputModel()
            {
                TraineeId   = trainee.TraineeId,
                FullName    = trainee.FullName,
                PhoneHome   = trainee.PhoneHome,
                PhoneMobile = trainee.PhoneMobile,
                DoB         = trainee.DoB.ToString("dd/MM/yyyy"),
                Address     = trainee.Address,
                Email       = trainee.Email,
                Gender      = (await _genderService.GetGenderById(trainee.GenderId)).Description
            };
            return(Page());
        }