Example #1
0
        public static MvcHtmlString CategoryLink(this HtmlHelper help, CategoryName category)
        {
            return help.ActionLink(category.Name, "Category", "Blognew",
                new
                {
                    category = category.UrlName

                },
            new
            {
                title = string.Format("See All Posts in {0}", category.Name)

            });
        }
Example #2
0
        public ContentResult EditCategory(CategoryName category)
        {
            string json;

              if (ModelState.IsValid)
              {
            repo.EditCategory(category);
            json = JsonConvert.SerializeObject(new
            {
              id = category.Id,
              success = true,
              message = "Changes saved successfully."
            });
              }
              else
              {
            json = JsonConvert.SerializeObject(new
            {
              id = 0,
              success = false,
              message = "Failed to save the changes."
            });
              }

              return Content(json, "application/json");
        }