public async Task<Member> AddMember(Member member)
{
var model = new Member();
try
{
var retval = await _flurlClient.Request(Constants.AddMember)
.PostJsonAsync(new Member()
{
MemberId = member.MemberId,
SrNo = member.SrNo,
SeatNo = member.SeatNo,
Name = member.Name,
Gender = member.Gender,
FatherName = member.FatherName,
MotherName = member.MotherName,
HighestQualification = member.HighestQualification,
PreparingFor = member.PreparingFor,
PreferredBookName = member.PreferredBookName,
PermanentAddress = new Address()
{
Id = member.PermanentAddress.Id,
Village_Mohalla = member.PermanentAddress.Village_Mohalla,
PoliceStation = member.PermanentAddress.PoliceStation,
PostOffice = member.PermanentAddress.PostOffice,
District = member.PermanentAddress.District,
PinCode = member.PermanentAddress.PinCode,
AddressType = member.PermanentAddress.AddressType,
Description = member.PermanentAddress.Description,
IsActive = true
},
LocalAddress = new Address()
{
Id = member.LocalAddress.Id,
Village_Mohalla = member.LocalAddress.Village_Mohalla,
PoliceStation = member.LocalAddress.PoliceStation,
PostOffice = member.LocalAddress.PostOffice,
District = member.LocalAddress.District,
PinCode = member.LocalAddress.PinCode,
AddressType = member.LocalAddress.AddressType,
Description = member.LocalAddress.Description,
IsActive = true
},
FatherMobileNo = member.FatherMobileNo,
MobileNo = member.MobileNo,
FormPath = member.FormPath,
DocumentPath = member.DocumentPath,
ExitDate = member.ExitDate,
IsActive = true,
CreatedBy = 0
});
}
catch (FlurlHttpException ex)
{
var error = await ex.GetResponseJsonAsync();
}
return member;
}
What I have tried:
var retval = await _flurlClient.Request(Constants.AddMember)
.PostJsonAsync(objMember)
In postman same api is working fine with below request
{
"memberId": 0,
"srNo": 0,
"seatNo": 0,
"name": "string",
"gender": 0,
"fatherName": "string",
"motherName": "string",
"highestQualification": "string",
"preparingFor": "string",
"preferredBookName": "string",
"permanentAddress": {
"addressId": 0,
"village_Mohalla": "string",
"policeStation": "string",
"postOffice": "string",
"district": "string",
"pinCode": 0,
"addressType": 0,
"description": "string",
"isActive": 0
},
"localAddress": {
"addressId": 0,
"village_Mohalla": "string",
"policeStation": "string",
"postOffice": "string",
"district": "string",
"pinCode": 0,
"addressType": 0,
"description": "string",
"isActive": 0
},
"fatherMobileNo": "string",
"mobileNo": "string",
"formPath": "string",
"documentPath": "string",
"exitDate": "string",
"isActive": 0,
"createdBy": 0
}