Exemplo n.º 1
0
 public void Post([FromBody] Model.Employee employee)
 {
     using (EFDataContext dataContext = new EFDataContext())
     {
         var emp = dataContext.Employee.Add(employee);
         dataContext.SaveChanges();
     }
 }
Exemplo n.º 2
0
        public void Put(int EmployeeID, [FromBody] Model.Employee employee)
        {
            using (EFDataContext dataContext = new EFDataContext())
            {
                var emp = dataContext.Employee.FirstOrDefault(e => e.EmployeeID == EmployeeID);

                if (emp != null)
                {
                    emp.EmployeeFirstName = employee.EmployeeFirstName;
                    emp.EmployeeLastName  = employee.EmployeeLastName;
                    emp.Gender            = employee.Gender;
                    emp.Designation       = employee.Designation;
                    emp.Department        = employee.Department;
                }



                dataContext.SaveChanges();
            }
        }