Esempio n. 1
0
        public virtual ApiCallStatusClientRequestModel MapServerResponseToClientRequest(
            ApiCallStatusServerResponseModel response)
        {
            var request = new ApiCallStatusClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Esempio n. 2
0
        public virtual ApiCallStatusServerResponseModel MapEntityToModel(
            CallStatus item)
        {
            var model = new ApiCallStatusServerResponseModel();

            model.SetProperties(item.Id,
                                item.Name);

            return(model);
        }
Esempio n. 3
0
        public virtual ApiCallStatusServerResponseModel MapServerRequestToResponse(
            int id,
            ApiCallStatusServerRequestModel request)
        {
            var response = new ApiCallStatusServerResponseModel();

            response.SetProperties(id,
                                   request.Name);
            return(response);
        }
        public void MapEntityToModel()
        {
            var        mapper = new DALCallStatusMapper();
            CallStatus item   = new CallStatus();

            item.SetProperties(1, "A");
            ApiCallStatusServerResponseModel response = mapper.MapEntityToModel(item);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Esempio n. 5
0
        public virtual async Task <UpdateResponse <ApiCallStatusServerResponseModel> > Update(
            int id,
            ApiCallStatusServerRequestModel model)
        {
            var validationResult = await this.CallStatusModelValidator.ValidateUpdateAsync(id, model);

            if (validationResult.IsValid)
            {
                CallStatus record = this.DalCallStatusMapper.MapModelToEntity(id, model);
                await this.CallStatusRepository.Update(record);

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

                ApiCallStatusServerResponseModel apiModel = this.DalCallStatusMapper.MapEntityToModel(record);
                await this.mediator.Publish(new CallStatusUpdatedNotification(apiModel));

                return(ValidationResponseFactory <ApiCallStatusServerResponseModel> .UpdateResponse(apiModel));
            }
            else
            {
                return(ValidationResponseFactory <ApiCallStatusServerResponseModel> .UpdateResponse(validationResult));
            }
        }
Esempio n. 6
0
 public CallStatusUpdatedNotification(ApiCallStatusServerResponseModel record)
 {
     this.Record = record;
 }
Esempio n. 7
0
        public virtual ApiCallServerResponseModel MapEntityToModel(
            Call item)
        {
            var model = new ApiCallServerResponseModel();

            model.SetProperties(item.Id,
                                item.AddressId,
                                item.CallDispositionId,
                                item.CallStatusId,
                                item.CallString,
                                item.CallTypeId,
                                item.DateCleared,
                                item.DateCreated,
                                item.DateDispatched,
                                item.QuickCallNumber);
            if (item.AddressIdNavigation != null)
            {
                var addressIdModel = new ApiAddressServerResponseModel();
                addressIdModel.SetProperties(
                    item.AddressIdNavigation.Id,
                    item.AddressIdNavigation.Address1,
                    item.AddressIdNavigation.Address2,
                    item.AddressIdNavigation.City,
                    item.AddressIdNavigation.State,
                    item.AddressIdNavigation.Zip);

                model.SetAddressIdNavigation(addressIdModel);
            }

            if (item.CallDispositionIdNavigation != null)
            {
                var callDispositionIdModel = new ApiCallDispositionServerResponseModel();
                callDispositionIdModel.SetProperties(
                    item.CallDispositionIdNavigation.Id,
                    item.CallDispositionIdNavigation.Name);

                model.SetCallDispositionIdNavigation(callDispositionIdModel);
            }

            if (item.CallStatusIdNavigation != null)
            {
                var callStatusIdModel = new ApiCallStatusServerResponseModel();
                callStatusIdModel.SetProperties(
                    item.CallStatusIdNavigation.Id,
                    item.CallStatusIdNavigation.Name);

                model.SetCallStatusIdNavigation(callStatusIdModel);
            }

            if (item.CallTypeIdNavigation != null)
            {
                var callTypeIdModel = new ApiCallTypeServerResponseModel();
                callTypeIdModel.SetProperties(
                    item.CallTypeIdNavigation.Id,
                    item.CallTypeIdNavigation.Name);

                model.SetCallTypeIdNavigation(callTypeIdModel);
            }

            return(model);
        }
Esempio n. 8
0
 public void SetCallStatusIdNavigation(ApiCallStatusServerResponseModel value)
 {
     this.CallStatusIdNavigation = value;
 }