コード例 #1
0
 public void EmployeeMethod(Employee1 employee)
 {
     using (DbConfiguration db = new DbConfiguration())
     {
         db.Add(employee);
         db.SaveChanges();
     }
 }
コード例 #2
0
 public void Deleteemp(Employee1 employee)
 {
     using (DbConfiguration db = new DbConfiguration())
     {
         db.Employees.Remove(employee);
         db.SaveChanges();
     }
 }
コード例 #3
0
        public List <Employee1> GetAllList()
        {
            using (DbConfiguration db = new DbConfiguration())
            {
                var getlist = db.Employees.ToList();

                return(getlist);
            }
        }
コード例 #4
0
        public Employee1 GetRow(int id)
        {
            using (DbConfiguration db = new DbConfiguration())
            {
                var getlist = db.Employees.FirstOrDefault(x => x.Id == id);


                return(getlist);
            }
        }
コード例 #5
0
        public Employee1 updateemp(Employee1 employee)
        {
            using (DbConfiguration db = new DbConfiguration())
            {
                var model = db.Employees.FirstOrDefault(x => x.Id == employee.Id);

                model.Name        = employee.Name;
                model.Designation = employee.Designation;
                model.Code        = employee.Code;
                model.Address     = employee.Address;
                db.SaveChanges();
                return(model);
            }
        }