Ejemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Trainer trainer = new Trainer()
                    {
                        Address1       = Input.Address1,
                        Address2       = Input.Address2,
                        FullName       = Input.FullName,
                        Email          = Input.Email,
                        IsDeleted      = 0,
                        PhoneHome      = Input.PhoneHome,
                        PhoneMobile    = Input.PhoneMobile,
                        Specialization = Input.Specialization
                    };

                    var status = await _trainerService.Insert(trainer);
                }
                return(new RedirectToPageResult("Index"));
            }
            catch (OzoneException ex)
            {
                return(RedirectToPage("/Error", ex.Message));
            }
            catch (Exception ex)
            {
                return(RedirectToPage("/Error", ex.Message));
            }
        }