Esempio n. 1
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            try
            {
                Customer = _customerRepository.Update(Customer);
            }
            catch (Exception)
            {
                if (!_customerRepository.Exists(Customer.CustomerId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            Customer = _customerRepository.Insert(Customer);

            return(RedirectToPage("./Index"));
        }
        public IActionResult OnGet(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Customer = _customerRepository.Get(id.Value);

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

            return(Page());
        }