コード例 #1
0
ファイル: Edit.cshtml.cs プロジェクト: decentprogrammer/Ozone
        public async Task <IActionResult> OnGet(int id)
        {
            try
            {
                var trainer = await _trainerService.GetTrainerById(id);

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

                Input = new InputModel()
                {
                    TrainerId      = trainer.TrainerId,
                    Address1       = trainer.Address1,
                    Address2       = trainer.Address2,
                    FullName       = trainer.FullName,
                    Email          = trainer.Email,
                    PhoneHome      = trainer.PhoneHome,
                    PhoneMobile    = trainer.PhoneMobile,
                    Specialization = trainer.Specialization
                };

                return(Page());
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #2
0
ファイル: AdminController.cs プロジェクト: Pizayn/FitBody
        public IActionResult TrainerEdit(int trainerId)
        {
            TrainerEditViewModel trainerEditViewModel = new TrainerEditViewModel()
            {
                Trainer = _trainerService.GetTrainerById(trainerId),
            };

            return(View(trainerEditViewModel));
        }
コード例 #3
0
        public IActionResult GetTrainer(long id)
        {
            var trainer = _trainerService.GetTrainerById(id);

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

            return(Ok(trainer));
        }
コード例 #4
0
        public async Task <IActionResult> OnGet(int id)
        {
            var trainer = await _trainerService.GetTrainerById(id, includeDetails : true);

            Input = new InputModel()
            {
                FullName    = trainer.FullName,
                Email       = trainer.Email,
                PhoneHome   = trainer.PhoneHome,
                PhoneMobile = trainer.PhoneMobile,
                Address1    = trainer.Address1,
                Address2    = trainer.Address2
            };
            return(Page());
        }