Created
November 29, 2013 08:35
-
-
Save tugberkugurlu/7702958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Data Layer Model (Entity) | |
public class Store : IEntity<int>, ISlug, ILocatable | |
{ | |
public int Id { get; set; } | |
public string TypeId { get; set; } | |
[Required] | |
[StringLength(50)] | |
public string Name { get; set; } | |
// ISlug | |
[Required] | |
[StringLength(100)] | |
public string Slug { get; set; } | |
// Others | |
[Required] | |
[StringLength(15)] | |
public string PhoneNumber { get; set; } | |
[Required] | |
[StringLength(500)] | |
public string Address { get; set; } | |
// ILocatable | |
[Required] | |
public DbGeography Location { get; set; } | |
// IEntity | |
public DateTimeOffset CreatedOn { get; set; } | |
public StoreType Type { get; set; } | |
public ICollection<StoreImage> StoreImages { get; set; } | |
public ICollection<StoreRating> StoreRatings { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Business Layer Objects | |
public class StoreRepresentation | |
{ | |
public int Id { get; set; } | |
public string Type { get; set; } | |
public string Name { get; set; } | |
public string Slug { get; set; } | |
public string PhoneNumber { get; set; } | |
public string Address { get; set; } | |
public Location Location { get; set; } | |
public RatingRepresentation RatingSummary { get; set; } | |
} | |
public class Location | |
{ | |
public Location(double latitude, double longitude) | |
{ | |
Latitude = latitude; | |
Longitude = longitude; | |
} | |
public double Latitude { get; private set; } | |
public double Longitude { get; private set; } | |
} | |
public class RatingRepresentation | |
{ | |
public int RatingCount { get; set; } | |
public float? RatingPoint { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// API Layer models (inside the PCL project) which I use inside my API project and .NET Client project (HttpClient) | |
public class StoreResource : IResource | |
{ | |
public int Id { get; set; } | |
public string Type { get; set; } | |
public string Name { get; set; } | |
public string Slug { get; set; } | |
public string PhoneNumber { get; set; } | |
public string Address { get; set; } | |
public LocationResource Location { get; set; } | |
public RatingSummaryResource RatingSummary { get; set; } | |
} | |
public class LocationResource : IResource | |
{ | |
public LocationIResource() | |
{ | |
} | |
public LocationResource(double latitude, double longitude) | |
{ | |
Latitude = latitude; | |
Longitude = longitude; | |
} | |
public double Latitude { get; set; } | |
public double Longitude { get; set; } | |
} | |
public class RatingSummaryResource : IResource | |
{ | |
public int RatingCount { get; set; } | |
public float? RatingPoint { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment