Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

When I post to asp.net core webapi I see null value in db

$
0
0

Please guys what is the problem I frequently get a null value post from my php wamp to asp.net core webapi server

[Route("api/[controller]")]
public class AfritalkController : Controller
{
//Declaring the variables of the controller
private IUSSDService ussdService { get; set; }

public AfritalkController(IUSSDService ussdService)
{
this.ussdService = ussdService;
}


// POST: api/Default
[HttpPost("post1")]
public async Task<int> Post([FromBody]string value)
{
int result = await this.ussdService.AddUssdrequest(value);

return result;
}


[HttpPost("postsession")]
//[ActionName("postsession")]
public async Task<int> Post(Sessionview model)
{
int result = await this.ussdService.Addsession(model.SessionID, model.Phone, model.Level);

return result;
}


// PUT: api/Default/5
[HttpPut("{id}")]
public async Task<int> Put(string id, [FromBody]string value)
{
string sessionid = id; string level = value;

int result = await this.ussdService.Updatesession(sessionid, level);

return result;
}

}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>