creazione primi repository e interfacce

This commit is contained in:
Riccardo Usardi committed 2025-07-04 19:12:25 +02:00
1 parent b7983dae8e
commit 0a6744e8b0
19 files changed
+644 -39

No files matched your search

+16 -2
View File
@@ -1,4 +1,6 @@
namespace uWine.Core.Domain.Entities
using MySqlConnector;
namespace uWine.Core.Domain.Entities
{
public class Contact
{
@@ -8,8 +10,20 @@
public int Priority { get; set; }
public string Notes { get; set; }
public DateTime CreationDate { get; set; }
public DateTime? UpdatedDate { get; set; }
public DateTime? UpdateDate { get; set; }
public bool Active { get; set; }
public static Contact FromRecord(MySqlDataReader reader)
{
return new Contact
{
Id = reader.GetInt32("id"),
Value = reader.GetString("contact"),
Priority = reader.GetInt32("priority"),
Notes = reader.GetString("note"),
CreationDate = reader.GetDateTime("creation_date"),
UpdateDate = reader.GetDateTime("update_date"),
};
}
}
}
+11
View File
@@ -6,5 +6,16 @@
public string Type { get; set; }
public string Description { get; set; }
public bool Active { get; set; }
public static ContactType FromRecord(MySqlConnector.MySqlDataReader reader)
{
return new ContactType
{
Id = reader.GetInt32("id"),
Type = reader.GetString("type"),
Description = reader.GetString("description"),
Active = reader.GetBoolean("active")
};
}
}
}
+14 -1
View File
@@ -12,5 +12,18 @@
public List<Contact> Contacts { get; set; }
public List<Vineyard> Vineyards { get; set; }
public List<Address> Addresses { get; set; }
}
public static Owner FromRecord(MySqlConnector.MySqlDataReader reader)
{
return new Owner
{
Id = reader.GetInt32("id"),
Name = reader.GetString("first_name"),
Surname = reader.GetString("last_name"),
CompanyName = reader.GetString("company_name"),
IsActive = reader.GetBoolean("active"),
CreationDate = reader.GetDateTime("creation_date"),
Note = reader.GetString("note")
};
}
}