1
'u kullanırken değer döndürmez. Aşağıdaki kodda "tüm kod yollarının değerlerini döndürmüyor" alıyorum. Aşağıdaki kodum var. Sanırım uygun şekilde geri dönüyorum ama yine de bir hata var.Tüm kod yolları, Catch
[Route("User")]
public HttpResponseMessage Post([FromBody] Employee employee)
//FromBody forces the web api to read a simple tye from the request body.
{
try
{
Employee incomingEmployee = employee;
if (incomingEmployee == null)
{
Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not read the request");
}
else if (UserManager.AddUser(employee) > 0)
{
return Request.CreateResponse(HttpStatusCode.Created);
}
else
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not save to database");
}
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
}
}
Bunu görmediğime inanamıyorum .... çok teşekkür ederim – Virodh