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"); }
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"); }
public virtual BOVPerson MapModelToBO( int personId, ApiVPersonRequestModel model ) { BOVPerson boVPerson = new BOVPerson(); boVPerson.SetProperties( personId, model.PersonName); return(boVPerson); }
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"); }
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)); }