public ContactFormSubmission Get(int id) { using (var c = _accessor.Context()) { return(c.Context.ContactFormSubmissions .SingleOrDefault(s => s.SubmissionId == id)); } }
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()); } }
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()); } }
public void Save(ContactFormSubmission submission) { using (var c = _accessor.Context()) { c.Context.ContactFormSubmissions.AddObject(submission); c.Context.SaveChanges(); } }
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()); } }
public CurriculumVitae GetLatest() { using (var d = _accessor.Context()) { return(d.Context.CurriculaVitae .OrderByDescending(cv => cv.DateAdded) .FirstOrDefault()); } }
public Contract LatestContract() { using (var d = _accessor.Context()) { return(d.Context.Contracts .Include(c => c.Client) .OrderByDescending(c => c.EndDate) .FirstOrDefault()); } }
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()); } }
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()); } }