-
Notifications
You must be signed in to change notification settings - Fork 0
/
phoneBook.cs
66 lines (40 loc) · 1.54 KB
/
phoneBook.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System.Collections.Generic;
using Kavya.Phonebook;
using System;
public class PhoneBook
{
List<Contact> contacts = new List<Contact>();
Contact contact = new Contact();
JsonHandler jsonhandler = new JsonHandler();
ConsoleHandler handler = new ConsoleHandler();
public void AddContact(Contact contactToAdd)
{
contacts.Add(contactToAdd);
return;
}
public List<Contact> display()
{
return contacts;
}
public void DeleteContact(Contact contactToDelete)
{
contacts.Remove(contactToDelete);
}
public void addfile()
{
jsonhandler.exportToFile(contacts);
}
public void EditContact() => handler.editName(contacts);
public void PrintContactList(){
foreach ( Contact person in contacts){
Console.WriteLine("Name :" +person.FirstName +person.LastName +"PhoneNumber :"+person.PhoneNumber +"\nEmail Id:" +person.MailId);
}
}
// public void searchContact()
//{
// Console.WriteLine("enter the name to search ") ;
// string name = Console.ReadLine();
// contact.find(name);
// Console.WriteLine("the contact No of {0} is {1}",name,Value) ;
//}
}