public JsonResult AddPublication(string name) { var publication = new ServiceBookPublication(); publication.servicePublications = name; context.bookPublication.Add(publication); context.SaveChanges(); return(Json(new { result = "success" })); }
public IHttpActionResult PostServicePublications(ServiceBookPublication serviceBookPublication) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.bookPublication.Add(serviceBookPublication); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = serviceBookPublication.serviceBookPublicationId }, serviceBookPublication)); }