asp.net web api2 - Return true/false along with model data -
i'm attempting return true or false (in json) along model data. code builds , runs fine return on model data.
what i've tried reading other answers:
public iqueryable<book> getbooks() { httpresponsemessage response = request.createresponse(httpstatuscode.ok); return db.books; }
as can see, don't have greatest idea of i'm doing, through infinite wisom of community hope learn feat.
i create view model , returned controller
public class booksvm { public iqueryable<book> books { get; set; } public bool booleanvalue { get; set; } }
and in controller
public ihttpactionresult getbooks() { var booksvm = new booksvm() { books = db.books, booleanvalue = true }; return ok(booksvm); }
Comments
Post a Comment