示例#1
0
        public void addEmpHistory(EmployementHistory empH)
        {
            dbContext.Add(empH);
            dbContext.SaveChanges();

            Console.WriteLine("added history");
        }
        public void AddEmp(Object data)
        {
            var obj = Newtonsoft.Json.JsonConvert.DeserializeObject <RecievedEmp>(data.ToString());

            Employee emp = new Employee
            {
                name    = obj.name,
                payment = obj.payment
            };

            Position pos = new Position {
                name = obj.title,
            };

            dbservice.addEmployee(emp);

            var idEmp = dbservice.getLastEmp();
            var posId = dbservice.getPosByName(pos.name);



            Console.WriteLine(posId + " hwejrhkewhrkjew");


            EmployementHistory empHis = new EmployementHistory
            {
                From        = obj.employed,
                until       = obj.fired,
                position    = pos,
                employee    = emp,
                Employee_id = idEmp,
                position_id = posId.idPosiotion
            };


            dbservice.addEmpHistory(empHis);
        }