public ActionResult Categoria(string id) { //consumir el servicio qu epoblas categorias PublicationService publicationService = new PublicationService(); List<Category> categorias = new List<Category>(); categorias = publicationService.getCategory(id); ViewBag.Categories = categorias; //ViewBag.Message = ""+categorias[0].category_name; return View(); }
public void CategoriaAjax(string id) { //consumir el servicio qu epoblas categorias PublicationService publicationService = new PublicationService(); List<Category> categorias = new List<Category>(); categorias = publicationService.getCategory(id); // JsonResult data_category = new JsonResult(); // Response.Write( categorias); var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(categorias); Response.Write(json); }