Добавьте файлы проекта.

This commit is contained in:
zcher
2025-12-14 18:15:23 +03:00
parent 9d11002bed
commit 81524b0ffb
11 changed files with 290 additions and 0 deletions

33
Models/Contact.cs Normal file
View File

@@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
using System.Net.Mail;
namespace ContactsApp
{
public class Contact
{
public Guid Id { get; }
public string Name { get; set; }
public string? Email { get; set; }
public string Phone { get; set; }
public Contact(string name, string? email, string phone)
{
Id = Guid.NewGuid();
Name = name;
try
{
var addr = new MailAddress(email);
Email = email;
}
catch (Exception ex)
{
throw new Exception("Invalid email");
}
Phone = phone;
}
}
}