public virtual ApiCallAssignmentClientRequestModel MapServerResponseToClientRequest(
            ApiCallAssignmentServerResponseModel response)
        {
            var request = new ApiCallAssignmentClientRequestModel();

            request.SetProperties(
                response.CallId,
                response.UnitId);
            return(request);
        }
        public virtual ApiCallAssignmentServerResponseModel MapServerRequestToResponse(
            int id,
            ApiCallAssignmentServerRequestModel request)
        {
            var response = new ApiCallAssignmentServerResponseModel();

            response.SetProperties(id,
                                   request.CallId,
                                   request.UnitId);
            return(response);
        }
Exemple #3
0
        public void MapEntityToModel()
        {
            var            mapper = new DALCallAssignmentMapper();
            CallAssignment item   = new CallAssignment();

            item.SetProperties(1, 1, 1);
            ApiCallAssignmentServerResponseModel response = mapper.MapEntityToModel(item);

            response.CallId.Should().Be(1);
            response.Id.Should().Be(1);
            response.UnitId.Should().Be(1);
        }
Exemple #4
0
        public virtual ApiCallAssignmentServerResponseModel MapEntityToModel(
            CallAssignment item)
        {
            var model = new ApiCallAssignmentServerResponseModel();

            model.SetProperties(item.Id,
                                item.CallId,
                                item.UnitId);
            if (item.CallIdNavigation != null)
            {
                var callIdModel = new ApiCallServerResponseModel();
                callIdModel.SetProperties(
                    item.CallIdNavigation.Id,
                    item.CallIdNavigation.AddressId,
                    item.CallIdNavigation.CallDispositionId,
                    item.CallIdNavigation.CallStatusId,
                    item.CallIdNavigation.CallString,
                    item.CallIdNavigation.CallTypeId,
                    item.CallIdNavigation.DateCleared,
                    item.CallIdNavigation.DateCreated,
                    item.CallIdNavigation.DateDispatched,
                    item.CallIdNavigation.QuickCallNumber);

                model.SetCallIdNavigation(callIdModel);
            }

            if (item.UnitIdNavigation != null)
            {
                var unitIdModel = new ApiUnitServerResponseModel();
                unitIdModel.SetProperties(
                    item.UnitIdNavigation.Id,
                    item.UnitIdNavigation.CallSign);

                model.SetUnitIdNavigation(unitIdModel);
            }

            return(model);
        }
Exemple #5
0
        public virtual async Task <UpdateResponse <ApiCallAssignmentServerResponseModel> > Update(
            int id,
            ApiCallAssignmentServerRequestModel model)
        {
            var validationResult = await this.CallAssignmentModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                CallAssignment record = this.DalCallAssignmentMapper.MapModelToEntity(id, model);
                await this.CallAssignmentRepository.Update(record);

                record = await this.CallAssignmentRepository.Get(id);

                ApiCallAssignmentServerResponseModel apiModel = this.DalCallAssignmentMapper.MapEntityToModel(record);
                await this.mediator.Publish(new CallAssignmentUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiCallAssignmentServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiCallAssignmentServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Exemple #6
0
 public CallAssignmentUpdatedNotification(ApiCallAssignmentServerResponseModel record)
 {
     this.Record = record;
 }