Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Freelancer
- {
- public int ID { get; set; }
- public string Email { get; set; }
- public string Password { get; set; }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- public string CompanyName { get; set; }
- public string Avatar { get; set; }
- public Address FreelancerAddress { get; set; }
- public ICollection<Client> Clients { get; set; }
- }
- public class Address
- {
- public int AddressId { get; set; }
- public string Street { get; set; }
- public string City { get; set; }
- public string State { get; set; }
- public string PostalCode { get; set; }
- public string Phone { get; set; }
- public string Email { get; set; }
- }
- public class Client
- {
- public int ID { get; set; }
- public string Name { get; set; }
- public Address ClientAddress { get; set; }
- public string Logo { get; set; }
- public ICollection<Project> Projects { get; set; }
- public int FreelancerID { get; set; }
- public Freelancer Freelancer { get; set; }
- }
- public IEnumerable<Freelancer> Get()
- {
- var user = Uow.Freelancers.GetFreelancer(1);
- var result = from x in user
- select new
- {
- ID = x.ID,
- Name = x.LastName,
- Address = x.FreelancerAddress.Street
- };
- return result;
- }
- [{"iD":1,"email":"david.stanley.13@gmail.com","password":"password","firstName":"David","lastName":"Stanley","companyName":null,"avatar":null,"freelancerAddress":null,"clients":null}]
- public IEnumerable<Freelancer> GetFreelancer(int id)
- {
- IEnumerable<Freelancer> freelancer = (from x in DbSet
- select x);
- return freelancer;
- }
- IEnumerable<Freelancer> freelancer = from x in DbSet
- .Include("FreelancerAddress")
- .Include("Clients")
- where x.ID == id
- select x;
- return freelancer;
- public class Client
- {
- public int ID { get; set; }
- public string Name { get; set; }
- public Address ClientAddress { get; set; }
- public string Logo { get; set; }
- public ICollection<Project> Projects { get; set; }
- public int FreelancerID { get; set; }
- }
- public IEnumerable<Freelancer> GetFreelancer(int id)
- {
- IEnumerable<Freelancer> freelancer = from x in DbSet.Freelancers
- .Include("Address")
- .Include("Client")
- where x.Id == id
- select x;
- return freelancer;
- }
Add Comment
Please, Sign In to add comment