public ContactFormSubmission Get(int id)
 {
     using (var c = _accessor.Context())
     {
         return(c.Context.ContactFormSubmissions
                .SingleOrDefault(s => s.SubmissionId == id));
     }
 }
Ejemplo n.º 2
0
 public IEnumerable <HistoryItem> ListPresentables(DateTime?olderThan, int take)
 {
     using (var c = _accessor.Context())
     {
         return(c.Context.History
                .OrderByDescending(s => s.DateStamp)
                .Where(s => !olderThan.HasValue || s.DateStamp < olderThan)
                .Take(take)
                // Project properties
                .Include(s => s.Project)
                .Include(s => s.Project.ProjectSkills)
                .Include(s => s.Project.ProjectSkills.Select(ps => ps.Skill))
                .Include(s => s.Project.Client)
                .Include(s => s.Project.Client.Logo)
                .Include(s => s.Project.Client.Logo.Thumbnail)
                .Include(s => s.Project.Contracts)
                .Include(s => s.Project.ThumbnailImage)
                // Client properties
                .Include(s => s.Client)
                .Include(s => s.Client.Logo)
                .Include(s => s.Client.Logo.Thumbnail)
                .Include(s => s.Client.Projects)
                .Include(s => s.Client.Projects.Select(p => p.ThumbnailImage))
                .Include(s => s.Client.Projects.Select(p => p.Contracts))
                // Testimonial propeties
                .Include(s => s.Testimonial)
                .Include(s => s.Testimonial.Person)
                .Include(s => s.Testimonial.Person.Thumbnail)
                .Include(s => s.Testimonial.Client)
                .ToList());
     }
 }
Ejemplo n.º 3
0
 public IEnumerable <Project> List(bool?featured)
 {
     using (var c = _accessor.Context())
     {
         return(c.Context.Projects
                .Where(p => !featured.HasValue || p.Featured == featured.Value)
                .Include(p => p.ProjectSkills)
                .Include(p => p.ProjectSkills.Select(ps => ps.Skill))
                .Include(p => p.Client)
                .Include(p => p.Client.Logo)
                .Include(p => p.Client.Logo.Thumbnail)
                .Include(p => p.Contracts)
                .Include(p => p.ThumbnailImage)
                .ToList());
     }
 }
Ejemplo n.º 4
0
 public void Save(ContactFormSubmission submission)
 {
     using (var c = _accessor.Context())
     {
         c.Context.ContactFormSubmissions.AddObject(submission);
         c.Context.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 private Skill get(int?id = null, string name = null)
 {
     if (string.IsNullOrEmpty(name) && !id.HasValue)
     {
         throw new ArgumentException("One of name and id arguments must be non-null");
     }
     using (var c = _accessor.Context())
     {
         return(c.Context.Skills
                .Where(s => (id.HasValue && s.SkillId == id.Value) || (!string.IsNullOrEmpty(name) && s.ShortName == name))
                .Include(s => s.SkillCategory)
                .Include(s => s.ProjectSkills)
                .Include(s => s.ProjectSkills.Select(ps => ps.Project))
                .Include(s => s.ProjectSkills.Select(ps => ps.Project.ThumbnailImage))
                .Include(s => s.ProjectSkills.Select(ps => ps.Project.Contracts))
                .SingleOrDefault());
     }
 }
Ejemplo n.º 6
0
 public CurriculumVitae GetLatest()
 {
     using (var d = _accessor.Context())
     {
         return(d.Context.CurriculaVitae
                .OrderByDescending(cv => cv.DateAdded)
                .FirstOrDefault());
     }
 }
Ejemplo n.º 7
0
 public Contract LatestContract()
 {
     using (var d = _accessor.Context())
     {
         return(d.Context.Contracts
                .Include(c => c.Client)
                .OrderByDescending(c => c.EndDate)
                .FirstOrDefault());
     }
 }
Ejemplo n.º 8
0
 public IEnumerable <Testimonial> List()
 {
     using (var c = _accessor.Context())
     {
         return(c.Context.Testimonials
                .Include(t => t.Person)
                .Include(t => t.Person.Thumbnail)
                .Include(t => t.Client)
                .ToList());
     }
 }
Ejemplo n.º 9
0
 public Client get(string name = null, int?id = null)
 {
     if (string.IsNullOrEmpty(name) && !id.HasValue)
     {
         throw new ArgumentException("One of name and id arguments must be non-null");
     }
     using (var c = _accessor.Context())
     {
         return(c.Context.Clients
                .Where(l => (id.HasValue && l.ClientId == id.Value) || (!string.IsNullOrEmpty(name) && l.ShortName == name))
                .Include(l => l.Logo)
                .Include(l => l.Logo.Thumbnail)
                .Include(l => l.Projects)
                .Include(l => l.Projects.Select(p => p.ThumbnailImage))
                .Include(l => l.Projects.Select(p => p.Contracts))
                .Include(l => l.Testimonials)
                .Include(l => l.Testimonials.Select(t => t.Person))
                .Include(l => l.Testimonials.Select(t => t.Person.Thumbnail))
                .SingleOrDefault());
     }
 }