По какой-то причине Request.CreateResponse
теперь "красный" в VS2012, и когда я наводил курсор на использование, IDE сообщает
Не удается разрешить символ "CreateResponse"
Вот класс ApiController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Filters;
using GOCApi.Attributes;
using GOCApi.Models;
using GOCApi.Models.Abstract;
using AttributeRouting;
using AttributeRouting.Web.Http;
namespace GOCApi.Controllers
{
[RoutePrefix("Courses")]
public class CoursesController : ApiController
{
private ICoursesRepository _coursesRepository { get; set; }
public CoursesController(ICoursesRepository coursesRepository)
{
_coursesRepository = coursesRepository;
}
[GET("{id}")]
public HttpResponseMessage Get(int id)
{
var course = _coursesRepository.GetSingle(id);
if (course == null)
return Request.CreateResponse(HttpStatusCode.NotFound, "Invalid ID");
return Request.CreateResponse(HttpStatusCode.OK, course);
}
}
}
Конечно, код компилируется и работает, он просто очень раздражает, видя все "красные" на моем экране. Кроме того, intellisense не работает сейчас, когда я набираю Request.CreateResponse
. Это также сработало, но я начал разрабатывать другие части для своего API и просто вернулся к контроллерам зданий, поэтому не знаю, что произошло.
Любые мысли?