예제 #1
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiVPersonModelMapper();
            var model  = new ApiVPersonResponseModel();

            model.SetProperties(1, "A");
            ApiVPersonRequestModel response = mapper.MapResponseToRequest(model);

            response.PersonName.Should().Be("A");
        }
예제 #2
0
        public void MapModelToBO()
        {
            var mapper = new BOLVPersonMapper();
            ApiVPersonRequestModel model = new ApiVPersonRequestModel();

            model.SetProperties("A");
            BOVPerson response = mapper.MapModelToBO(1, model);

            response.PersonName.Should().Be("A");
        }
예제 #3
0
        public virtual BOVPerson MapModelToBO(
            int personId,
            ApiVPersonRequestModel model
            )
        {
            BOVPerson boVPerson = new BOVPerson();

            boVPerson.SetProperties(
                personId,
                model.PersonName);
            return(boVPerson);
        }
예제 #4
0
        public void CreatePatch()
        {
            var mapper = new ApiVPersonModelMapper();
            var model  = new ApiVPersonRequestModel();

            model.SetProperties("A");

            JsonPatchDocument <ApiVPersonRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiVPersonRequestModel();

            patch.ApplyTo(response);
            response.PersonName.Should().Be("A");
        }
예제 #5
0
        private async Task <ApiVPersonRequestModel> PatchModel(int id, JsonPatchDocument <ApiVPersonRequestModel> patch)
        {
            var record = await this.VPersonService.Get(id);

            if (record == null)
            {
                return(null);
            }
            else
            {
                ApiVPersonRequestModel request = this.VPersonModelMapper.MapResponseToRequest(record);
                patch.ApplyTo(request);
                return(request);
            }
        }
 public async Task <ValidationResult> ValidateUpdateAsync(int id, ApiVPersonRequestModel model)
 {
     this.PersonNameRules();
     return(await this.ValidateAsync(model, id));
 }