Пример #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();
     }
 }
Пример #2
0
        public ProjectViewModel(CatalogueContainer context, string project)
            : base(context, null)
        {
            Title = "Проекты";

            foreach (var p in Projects.Where(p=>p.Name==project))
            {
                p.Current = true;
            }

            if (!string.IsNullOrEmpty(project))
            {
                Project = context.Project.Include("ProjectImages").First(c => c.Name == project);
                Title += " - " + Project.Title;
                SeoDescription = Project.SeoDescription;
                SeoKeywords = Project.SeoKeywords;
            }


        }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Project EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToProject(Project project)
 {
     base.AddObject("Project", project);
 }
Пример #4
0
 /// <summary>
 /// Create a new Project object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="sortOrder">Initial value of the SortOrder property.</param>
 public static Project CreateProject(global::System.Int32 id, global::System.String name, global::System.String title, global::System.Int32 sortOrder)
 {
     Project project = new Project();
     project.Id = id;
     project.Name = name;
     project.Title = title;
     project.SortOrder = sortOrder;
     return project;
 }