creazione primi repository e interfacce
This commit is contained in:
1 parent
b7983dae8e
commit
0a6744e8b0
19 files changed
+644
-39
No files matched your search
@@ -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"),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using uWine.Core.Domain.Entities;
|
||||
|
||||
namespace uWine.Core.Domain.Repositories
|
||||
{
|
||||
public interface IContactRepository
|
||||
{
|
||||
ContactType GetContactType(int contactTypeId);
|
||||
void InsertContactType(ContactType contactType);
|
||||
void InsertOwnerContact(Contact contact, int ownerId);
|
||||
List<Contact> OwnerContacts(int ownerId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using uWine.Core.Domain.Entities;
|
||||
|
||||
namespace uWine.Core.Domain.Repositories
|
||||
{
|
||||
public interface IOwnerRepository
|
||||
{
|
||||
void AddAddress(int ownerId, Address address);
|
||||
void Insert(Owner owner);
|
||||
Owner Simple(int ownerId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using uWine.Core.Domain.Entities;
|
||||
|
||||
namespace uWine.Core.Domain.Repositories
|
||||
{
|
||||
public interface IVineyardRepository
|
||||
{
|
||||
List<Vineyard> GetOwnerVineyards(int ownerId);
|
||||
void Insert(Vineyard vineyard, int ownerId);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("uWine.Core.Domain")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9036616a5922f1fdddd933a21ff41597a22b9d12")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b7983dae8eb41b8762561f39a8983964d6b51642")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("uWine.Core.Domain")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("uWine.Core.Domain")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
f4881d9a83679f0090798624563523a1b20e755faf7a53ce3f3323358a12e49b
|
||||
2938b75c4e5ef3e81cc5a8d84e687c6e2754a5a72fb2fca8be69fe3f8ccc7d39
|
||||
Reference in new issue
Block a user