David Smith

David Smith

  • NA
  • 2k
  • 0

Request.CreateResponse Error

Oct 22 2013 3:22 PM
I am getting an error below in red, I am not for sure why. I am using Project MVC4 project  (API Controller):

Error I am getting:

ErrorThe type arguments for method 'System.Net.Http.HttpRequestMessageExtensions.CreateResponse<T>(System.Net.Http.HttpRequestMessage, System.Net.HttpStatusCode, T)' cannot be inferred from the usage. Try specifying the type arguments explicitly.


   var ret = new
                {
                    CommentedBy = postcomment.CommentedBy,
                    CommentedByName = usr.Fullname,
                    //CommentedByAvatar = imgFolder + (String.IsNullOrEmpty(usr.AvatarExt) ? defaultAvatar : postcomment.CommentedBy + "." + postcomment.UserProfile.AvatarExt),
                    CommentedByAvatar = imgFolder + (String.IsNullOrEmpty(usr.AvatarExt) ? defaultAvatar : postcomment.CommentedBy + "." + postcomment.UserProfile.AvatarExt),
                  
                    CommentedDate = postcomment.CommentedDate,
                    CommentId = postcomment.CommentId,
                    Message = postcomment.Message,
                    PostId = postcomment.PostId
                };

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, ret);