コード例 #1
0
        private void AddContact(ContactRepo repository, int logUserId)
        {
            Console.WriteLine("#########################");
            Contact contact = new Contact();

            contact.ParentUserId = logUserId;
            Console.WriteLine("#### FirstName: ");
            contact.FirstName = Console.ReadLine();
            Console.WriteLine("#### LastName: ");
            contact.LastName = Console.ReadLine();
            Console.WriteLine("#### Email: ");
            contact.Email = Console.ReadLine();
            Console.WriteLine("#### Phone: ");
            contact.Phone = Console.ReadLine();
            repository.Add(contact);
            Console.Clear();
            Console.WriteLine("#########################");
            Console.WriteLine("####### D O N E ! #######");
            Console.WriteLine("#########################");
            Thread.Sleep(1000);
        }
コード例 #2
0
        public PartialViewResult _Contact(Contact contact)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(PartialView(contact));
                }

                contactRepo.Add(contact);
                contactRepo.SaveChanges();
                TempData["Contact"] = "Hello" + "" + contact.Name + "" + "your Comment has been recieved";

                return(PartialView());
            }
            catch
            {
                TempData["Contact"] = "Hello" + "" + contact.Name + "" + "your Comment didn't come by , Please try again. Thanks";
                return(PartialView("_Contact"));
            }
        }
コード例 #3
0
        private void AddContact(ContactRepo repository)
        {
            Console.Clear();
            Console.WriteLine("######### ADD CONTACT ###########");
            Contact contact = new Contact();

            contact.ParentUserId = AuthenticationService.LogUser.Id;
            Console.WriteLine("#### FirstName: ");
            contact.FirstName = Console.ReadLine();
            Console.WriteLine("#### LastName: ");
            contact.LastName = Console.ReadLine();
            Console.WriteLine("#### Email: ");
            contact.Email = Console.ReadLine();
            Console.WriteLine("#### Phone: ");
            contact.Phone = Console.ReadLine();
            repository.Add(contact);
            Console.Clear();
            Console.WriteLine("#########################");
            Console.WriteLine("####### D O N E ! #######");
            Console.WriteLine("#########################");
            Thread.Sleep(1000);
        }