Пример #1
0
        public async Task <HttpResponseMessage> UpdateCustomer(HttpRequestMessage request, [FromBody] InterviewUpdateDTO value)
        {
            try
            {
                await interviewService.UpdateCustomerInterview(value.Candidate.Value,
                                                               value.Date, value.EndDate);

                unitOfWork.Save();

                return(request.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                logger.Error(ex, JsonConvert.SerializeObject(value));

                return(request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }
Пример #2
0
        public async Task <HttpResponseMessage> UpdateGeneral(HttpRequestMessage request, [FromBody] InterviewUpdateDTO value)
        {
            try
            {
                var userId = ContextParser.GetUserId(request.GetRequestContext());

                var generalInterview = Mapper.Map <InterviewUpdateDTO, GeneralInterview>(value);

                generalInterview.HRM = userId;

                var events = await eventService.RegisterGeneralInterviewUpdate(generalInterview, userId);

                var updatedInterview = await interviewService.UpdateGeneralInterview(generalInterview);

                unitOfWork.Save();

                if (updatedInterview.Interviewer.HasValue)
                {
                    var notification = await notificationService.CreateNotification(updatedInterview.Interviewer.Value,
                                                                                    NotificationTypes.Update, events);

                    if (NotificationsHub.IsConnected(updatedInterview.Interviewer.Value))
                    {
                        await NotificationsHub.PushNotification(notification);
                    }
                }

                unitOfWork.Save();

                return(request.CreateResponse(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                logger.Error(ex, JsonConvert.SerializeObject(value));

                return(request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }