コード例 #1
0
        public Company CreateCompany(Company company)
        {
            db.Companies.Add(company);
            db.SaveChanges();

            return company;
        }
コード例 #2
0
 public void RemoveCompanyEvent(Company company, Event e)
 {
     if (e.cId == company.Id)
     {
         db.companyEvent.Remove(e);
     }
 }
コード例 #3
0
 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();
 }
コード例 #4
0
        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();
            }


        }
コード例 #5
0
        public Company RemoveCompany(Company company)
        {
            db.Companies.Remove(company);
            db.SaveChanges();

            return company;
        }
コード例 #6
0
        public Company EditCompany(Company company)
        {
            db.Entry(company).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return company;
        }
コード例 #7
0
 public List<Event> ListCompanyEvents(Company company)
 {
     List<Event> eventList = db.companyEvent.Where(e => e.cId == company.Id).ToList();
     return eventList;
 }
コード例 #8
0
        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();
        }
コード例 #9
0
        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();
        }
コード例 #10
0
 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();
 }