I receive such error message "Cannot implicity convert type
Test<prevResponse>
to Test<futureResponse>
", when I remap one layer to another.
My view model:
public class prevResponse
{
[JsonProperty(PropertyName = "HasHouse")]
[Required]
public bool HasHouse { get; set; }
[JsonProperty(PropertyName = "HasCar")]
[Required]
public bool HasCar { get; set; }
}
I Create identical class in other layer as the one above. I remap them:
public static class propertyRemaper
{
public static prevResponse DoMapping(futureResponse input)
{
var ret = new prevResponse
{
HasHouse = input.HasHouse,
HasCar = input.HasCar
};
return ret;
}
}
Once I try to use it as a serviceses agent:
public async Task<Result<futureResponse>> InfoAboutPerson(string name, string surname)
{
return await _testData.InfoAboutPerson(name, surname)
.Then(x => Result.Success(propertyRemaper.DoMapping(x)));
}
I receive an error. The whole text highlighted after return.
Interface for InfoAboutPerson below:
public interface ITestInterface
{
Task<Result<futureResponse>> getData(string name, string surname);
}
Any ideas how to convert it?