I know how to get data in json format from my MVC application (see below)
public JsonResult Index()
{
return Json(db.Publications, JsonRequestBehavior.AllowGet);
}
What would the create method look like? Edit?
I'm guessing it would look something like the following
[HttpPost]
public void Create(Publication publication)
{
try
{
db.Publications.Add(publication);
db.SaveChanges();
}
catch
{
// what do I catch?
}
}
If that is the case, what would my JSON call look like?
(Assuming the Publication class looks like the following)
public class Publication
{
public int Id { get; set; }
public String Title { get; set; }
}
Any help is appreciated.