コード例 #1
0
        public void Post([FromBody] Employee newEmployee)
        {
            Leadando_dbContext context = new Leadando_dbContext();

            context.Employees.Add(newEmployee);
            context.SaveChanges();
        }
コード例 #2
0
        public int M1()
        {
            Leadando_dbContext context = new Leadando_dbContext();
            var employeeCount          = (from x in context.Employees select x.EmployeeId).Count();

            return(employeeCount);
        }
コード例 #3
0
        public Employee Get(int id)
        {
            Leadando_dbContext context = new Leadando_dbContext();
            var keresettDolgozo        = (from x in context.Employees
                                          where x.EmployeeId == id
                                          select x).FirstOrDefault();

            return(keresettDolgozo);
        }
コード例 #4
0
        public void Delete(int id)
        {
            Leadando_dbContext context = new Leadando_dbContext();
            var torlendoDolgozo        = (from x in context.Employees
                                          where x.EmployeeId == id
                                          select x).FirstOrDefault();

            context.Remove(torlendoDolgozo);
            context.SaveChanges();
        }
コード例 #5
0
        public IEnumerable <Employee> Get()
        {
            Leadando_dbContext context = new Leadando_dbContext();

            return(context.Employees.ToList());
        }