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); }
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")); } }
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); }