daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Freelancer
  2. {
  3.     public int ID { get; set; }
  4.     public string Email { get; set; }
  5.     public string Password { get; set; }
  6.     public string FirstName { get; set; }
  7.     public string LastName { get; set; }
  8.     public string CompanyName { get; set; }
  9.     public string Avatar { get; set; }
  10.     public Address FreelancerAddress { get; set; }
  11.     public ICollection<Client> Clients { get; set; }
  12. }
  13.    
  14. public class Address
  15. {
  16.     public int AddressId { get; set; }
  17.     public string Street { get; set; }
  18.     public string City { get; set; }
  19.     public string State { get; set; }
  20.     public string PostalCode { get; set; }
  21.     public string Phone { get; set; }
  22.     public string Email { get; set; }
  23. }
  24.    
  25. public class Client
  26. {
  27.     public int ID { get; set; }
  28.     public string Name { get; set; }
  29.     public Address ClientAddress { get; set; }
  30.     public string Logo { get; set; }
  31.     public ICollection<Project> Projects { get; set; }
  32.     public int FreelancerID { get; set; }
  33.     public Freelancer Freelancer { get; set; }
  34. }
  35.    
  36. public IEnumerable<Freelancer> Get()
  37.     {
  38.         var user = Uow.Freelancers.GetFreelancer(1);
  39.         var result = from x in user
  40.                      select new
  41.                      {
  42.                          ID = x.ID,
  43.                          Name = x.LastName,
  44.                          Address = x.FreelancerAddress.Street
  45.                      };
  46.         return result;
  47.     }
  48.    
  49. [{"iD":1,"email":"david.stanley.13@gmail.com","password":"password","firstName":"David","lastName":"Stanley","companyName":null,"avatar":null,"freelancerAddress":null,"clients":null}]
  50.    
  51. public IEnumerable<Freelancer> GetFreelancer(int id)
  52.     {
  53.         IEnumerable<Freelancer> freelancer = (from x in DbSet
  54.                          select x);
  55.         return freelancer;
  56.     }
  57.    
  58. IEnumerable<Freelancer> freelancer = from x in DbSet
  59.                                      .Include("FreelancerAddress")
  60.                                      .Include("Clients")
  61.                                              where x.ID == id
  62.                                              select x;
  63.  
  64.         return freelancer;
  65.    
  66. public class Client
  67. {
  68.     public int ID { get; set; }
  69.     public string Name { get; set; }
  70.     public Address ClientAddress { get; set; }
  71.     public string Logo { get; set; }
  72.     public ICollection<Project> Projects { get; set; }
  73.     public int FreelancerID { get; set; }
  74. }
  75.    
  76. public IEnumerable<Freelancer> GetFreelancer(int id)
  77. {
  78.  
  79.     IEnumerable<Freelancer> freelancer = from x in DbSet.Freelancers
  80.                                          .Include("Address")
  81.                                          .Include("Client")
  82.                                          where x.Id == id
  83.                                          select x;
  84.  
  85.     return freelancer;
  86. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top