예제 #1
0
        public Task <HttpResponseMessage> Put([FromBody] dynamic body)
        {
            List <Job> listJob         = _serviceJob.AddJobToSession(body.job);
            var        user            = _serviceUser.GetOne((string)body.idUser);
            var        coachingProcess = _serviceCoachingProcess.GetOne(Guid.Parse((string)body.idCoachingProcess));

            var session = _serviceSession.GetOne(Guid.Parse((string)body.id));

            session = _serviceJob.CheckJobRemovedOfSession(listJob, session);

            var commandSession = new UpdateSessionCommand(
                Guid.Parse((string)body.id),
                coachingProcess,
                (string)body.theme,
                user,
                (DateTime)body.date,
                (TimeSpan)body.startTime,
                (TimeSpan)body.endTime,
                (ESessionClassification)body.classification,
                (string)body.observation,
                session.Job,
                session.EvaluationCoach,
                session.EvaluationCoachee
                );

            session = _serviceSession.Update(commandSession);
            var listEvaluationCoach = _serviceEvaluationCoach.AddToSession(body.coach, session.Id);

            _serviceEvaluationCoach.CheckEvaluationCoachRemoved(listEvaluationCoach, session.Id);

            var listEvaluationCoachee = _serviceEvaluationCoachee.AddToSession(body.coachee, session.Id);

            _serviceEvaluationCoachee.CheckEvaluationCoacheeRemoved(listEvaluationCoachee, session.Id);

            return(CreateResponse(HttpStatusCode.Created, session));
        }