I am working on an API method that should accept an Image
model object, which has a property List<Comment> Comments
. The Image
POSTed from the mobile app works fine but if I include an array of Comment
objects they aren't showing up on the instance of the Image
. I'm not super great with C# so any help would be appreciated.
Image Class
public class Image
{
public int? ImageId { get; set; }
[Required]
public string Image { get; set; }
[Required]
public string ContentType { get; set; }
[Required]
public string Filename { get; set; }
[Required]
public DateTime DateTaken { get; set; }
[Required]
public int UserId { get; set; }
[Required]
public int CompanyId { get; set; }
[Required]
public int LocationId { get; set; }
public decimal? Lat { get; set; }
public decimal? Long { get; set; }
public List<ApiComment> Comments { get; set; }
}
Comment Class
public class ApiComment
{
[Required]
public string Comment { get; set; }
[Required]
public DateTime DateCreated { get; set; }
[Required]
public int UserId { get; set; }
}
Beginning of ImagesController
public class ImagesController : ApiController
{
[System.Web.Http.HttpPost]
public ActionResult Post(Image image)