public static void AddNewEmployee(Employee.DTO headDto) { Employee newEmployee = new Employee() { Code = headDto.Code, Name = headDto.Name, Email = headDto.Email, Dept = headDto.Dept }; DakkaLinqDataContext db = DBHelper.GetDakkaLinqDataContext(); db.Employee.InsertOnSubmit(newEmployee); db.SubmitChanges(); }
public static Employee.DTO GetByID(long ID) { DakkaLinqDataContext db = DBHelper.GetDakkaLinqDataContext(); var result = db.Employee.SingleOrDefault(sd => sd.ID == ID); if (result == null) { throw new Exception("Can not find shiftDef by id: " + ID.ToString()); } Employee.DTO head = new Employee.DTO() { ID = result.ID, Code = result.Code, Name = result.Name, Email = result.Email, Dept = result.Dept }; return(head); }