Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Trainee trainee = new Trainee()
                    {
                        TraineeId   = Input.TraineeId,
                        Gender      = await _genderService.GetGenderById(Input.GenderId),
                        GenderId    = Input.GenderId,
                        Address     = Input.Address,
                        DoB         = Input.DoB,
                        Email       = Input.Email,
                        PhoneHome   = Input.PhoneHome,
                        PhoneMobile = Input.PhoneMobile,
                        FullName    = Input.FullName
                    };

                    var status = await _traineeService.Update(trainee);
                }
                return(new RedirectToPageResult("Index"));
            }
            catch (OzoneException ex)
            {
                return(RedirectToPage("/Error", ex.Message));
            }
            catch (Exception ex)
            {
                return(RedirectToPage("/Error", ex.Message));
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, TraineeModel model)
        {
            var result = _traineeService.Update(id, model);

            SetUserUpdate(id, DateTime.MinValue.Utc());
            //The return status check is performed in trainee script
            return(Json(result));
        }
Exemplo n.º 3
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"));
        }