public Company CreateCompany(Company company) { db.Companies.Add(company); db.SaveChanges(); return company; }
public void RemoveCompanyEvent(Company company, Event e) { if (e.cId == company.Id) { db.companyEvent.Remove(e); } }
public List<Vacancy> ListVacancies(Company Entity, string search) { var vacancies = db.vacancy.ToList(); var result = vacancies.Where(v => v.cId == Entity.Id).ToList(); var searchString = result.Where(r => r.Description.Contains(search)).ToString(); return result.OrderBy(v => v.Id).ToList(); }
public void CreateCompanyEvent(Company company, string title, string description, DateTime time) { var target = db.company.Find(company.Id); if (target != null) { var companyEvent = new Event { Title = title, Content = description, cId = target.Id, Time = time }; db.companyEvent.Add(companyEvent); db.SaveChanges(); } else { throw new Exception(); } }
public Company RemoveCompany(Company company) { db.Companies.Remove(company); db.SaveChanges(); return company; }
public Company EditCompany(Company company) { db.Entry(company).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return company; }
public List<Event> ListCompanyEvents(Company company) { List<Event> eventList = db.companyEvent.Where(e => e.cId == company.Id).ToList(); return eventList; }
public CompanyDetailsViewmodel(Company that) { this.Id = that.Id; this.Name = that.Name; this.Admins = that.Admins.Select(q => new UserListitemViewmodel() { Id = q.Id, Name = q.UserName }).ToList(); this.Leadership = that.Leadership.Select(q => new UserListitemViewmodel() { Id = q.Id, Name = q.UserName }).ToList(); this.Departments = that.Departments.Select(q => new CompanyDepartmentListitemViewmodel(q)).ToList(); this.NewsItems = that.NewsItems.OrderByDescending(q => q.Created).Take(3).Select(q => new NewsListitemViewmodel() { Id = q.Id, Title = q.Title, Content = q.Content, Created = q.Created, CreatorName = q.Creator.UserName }).ToList(); }
public CompanyOverviewViewmodel(Company that) { this.Id = that.Id; this.Name = that.Name; this.NewsItems = that.NewsItems.Where(q => q.IsPublic).OrderByDescending(q => q.Created).Take(3).Select(q => new NewsListitemViewmodel() { Id = q.Id, Title = q.Title, Content = q.Content, Created = q.Created, CreatorName = q.Creator.UserName }).ToList(); }
public List<Vacancy> ListVacancies(Company Entity) { var vacancies = db.vacancy.ToList(); var result = vacancies.Where(v => v.cId == Entity.Id && v.Active).ToList(); return result.OrderBy(v => v.Id).ToList(); }