コード例 #1
0
        public void Display()
        {
            var addOwner = new AddOwner();
            var done     = false;

            do
            {
                Console.Clear();
                Console.WriteLine("# Add new owner");

                Console.Write("\nFirst name: ");
                var firstName = Console.ReadLine();
                Console.Write("Last name: ");
                var lastName = Console.ReadLine();

                Console.Write("\nSocial security number (12 digits): ");
                var socSecNr = long.Parse(Console.ReadLine());

                Console.WriteLine("Is this correct (Y)es (N)o");
                var confirm = Console.ReadKey(true);

                if (confirm.Key == ConsoleKey.Y)
                {
                    addOwner.OwnerAdd(new Owner(firstName, lastName, socSecNr));
                    Console.WriteLine("\nOwner added successfully");
                    Thread.Sleep(1000);
                    done = true;
                }
                else
                {
                    Thread.Sleep(1000);
                    done = true;
                }
            } while (!done);
        }
コード例 #2
0
        public ActionResult Add(AddOwner addOwner)
        {
            if (this.ModelState.IsValid)
            {
                int result = addOwner.ExecuteNonQuery();
                return(Redirect($"/Providers/Owner/Profile/{addOwner.Id}"));
            }

            return(View("FormPage", addOwner));
        }
コード例 #3
0
        public ActionResult Add(AddOwner addOwner)
        {
            if (this.ModelState.IsValid)
            {
                int result = addOwner.ExecuteNonQuery();
                return(new JsonResult()
                {
                    Data = new { Result = "Success", Url = $"/Providers/Owner/Profile/{addOwner.Id}" }
                });
            }

            this.AddAjaxPost("/Providers/Owner/Add", "Add Owner", x => x.OnSuccess = "paw.onAjaxFormSuccess");

            return(View("FormModal", addOwner));
        }
コード例 #4
0
        private void AddCardOfOwner_Click(object sender, RoutedEventArgs e)
        {
            AddOwner addOwner = new AddOwner();

            addOwner.Show();
        }