Example #1
0
        public bool CreateEmployee(EmployeeEntity emp)
        {
            // Employee employee = new Employee();
            var employee = emp.ConvertToEmployeeDB();

            _database.Employees.Add(employee);
            int result = _database.SaveChanges();

            return(result > 0 ? true : false);
        }
Example #2
0
        public bool UpdateEmployee(EmployeeEntity emp)
        {
            Employee empData = _database.Employees.FirstOrDefault(e => e.Id == emp.Id);

            empData = emp.ConvertToEmployeeDB(empData);
            //empData.Name = emp.Name;
            //empData.Designation = emp.Designation;
            //empData.Department = emp.Department.Id;
            int result = _database.SaveChanges();

            return(result > 0 ? true : false);
        }