Esempio n. 1
0
        public static void SaveProject(Project p)
        {
            List<Project> pList = GetAllProjects();
            Project project = pList.SingleOrDefault(x => x.ProjectName == p.ProjectName);
            pList.Remove(project);
            pList.Add(p);
            AwesomeIt.Models.FileInfo fInfo = GetFileInfo();

            var serializer = new XmlSerializer(typeof(List<Project>));
            using (var writer = XmlWriter.Create(fInfo.FilePath))
            {
                serializer.Serialize(writer, pList);
            }
        }
Esempio n. 2
0
        public ActionResult NewProject(NewProjectForm form)
        {
            var model = new NewProjectModel();

            if (form.ProjectName == null)
            {

                model.Header = "Create a new project!";
                model.BodyText = "Create a new project here, and invite people to take part.";
                model.NewProjectForm = new NewProjectForm();
            }
            else
            {
                var projectModel = new Project() { ProjectName = form.ProjectName };

                XMLHelpers.SaveProject(projectModel);

                model.Header = "Du har oprettet et nyt projekt";
                model.BodyText = "Klik <a href=\"/projects/project/" + form.ProjectName + "\">HER</a> for at navigere hen til dit nye projekt, og inviterer folk til det!";
            }

            return base.Index(model);
        }