示例#1
0
 public ActionResult Create(FormCollection form)
 {
     try
     {
         using (var context = new CatalogueContainer())
         {
             var project = new Project();
             TryUpdateModel(project, new[]
                                         {
                                             "Name", 
                                             "Title", 
                                             "DescriptionTitle",
                                             "SortOrder",
                                             "SeoDescription",
                                             "SeoKeywords"
                                         });
             project.Description = HttpUtility.HtmlDecode(form["Description"]);
             project.Name=project.Name.ToLower().Replace(" ", "");
             context.AddToProject(project);
             context.SaveChanges();
             return RedirectToAction("Index", "Projects", new { Area = "", project = project.Name });
         }
     }
     catch
     {
         return View();
     }
 }