0

While I'm aware that MVC6 isn't released, it looks like it's missing many features of WebAPI and even MVC5. Can I assume that this isn't the way that it'll look on release?

[HttpPost("")]
public async Task<ActionResult> Post(Visit newVisit)
{
  var username = User.Identity.GetUserName();

  newVisit.UserName = username;

  if (await _repository.AddVisitAsync(newVisit))
  {
    Response.StatusCode = (int) HttpStatusCode.Created;

    return Json(newVisit);
  }

  return new HttpStatusCodeResult((int)HttpStatusCode.BadRequest);
}

Notice the casts in the Reponse.StatusCode and the HttpStatusCodeResult (I do miss just returning Ok(...), Created(...), etc.

Shawn Wildermuth
  • 7,318
  • 3
  • 23
  • 28

1 Answers1

2

Some features from MVC 5 and Web API 2 have not yet been brought over to MVC 6 (which includes Web API). Logging issues at https://github.com/aspnet/Mvc/issues is the right place to request any missing features. Please check for existing issues because many issues are already tracked.

Please note that several APIs got renamed when MVC and Web API got merged because we didn't want to have duplicate APIs, so even though an exact API match might not be there, it could just have a new name.

Eilon
  • 25,582
  • 3
  • 84
  • 102