Example #1
0
 public ActionResult Create(FormCollection form)
 {
     using (var context = new SiteContext())
     {
         var category = new Category();
         TryUpdateModel(category, new[] { "Name", "Title", "TitleToCategory", "SeoDescription", "SeoKeywords", "SortOrder" });
         category.Description = HttpUtility.HtmlDecode(form["Description"]);
         context.AddToCategory(category);
         context.SaveChanges();
         return RedirectToAction("Index", "Home", new { area = "", category = category.Name });
     }
 }
Example #2
0
 /// <summary>
 /// Create a new Category object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="sortOrder">Initial value of the SortOrder property.</param>
 public static Category CreateCategory(global::System.Int32 id, global::System.String title, global::System.String name, global::System.Int32 sortOrder)
 {
     Category category = new Category();
     category.Id = id;
     category.Title = title;
     category.Name = name;
     category.SortOrder = sortOrder;
     return category;
 }
Example #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Category EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCategory(Category category)
 {
     base.AddObject("Category", category);
 }