Esempio n. 1
0
        public async Task<ActionResult> Save(Project project)
        {
            var result = await Resolve<SavePostCommand>().Execute(project);

            if (Request.IsAjaxRequest())
            {
                return Json(new { id = result.Id, location = @Url.RouteUrl("Show", new { id = result.Id }) });
            }

            return RedirectToAction("Show", new { id = result.Id });
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            Project project;

            if (CurrentProjectId.IsEmpty() || (project = session.Load<Project>(CurrentProjectId)) == null)
            {
                project = new Project()
                    .AddOrUpdate(new Document { Name = "Main", Content = "return new Person(\"stranger\").Greet();" })
                    .AddOrUpdate(BuildSampleDocument());

                session.Store(project);
                CurrentProjectId = project.Id;
            }

            return View("Show", new WorkspaceState { Project = project });
        }
 public async Task<Project> Execute(Project project)
 {
     session.Store(project);
     await session.SaveChangesAsync();
     return project;
 }
 public IEnumerable<EditorError> Execute(Project project)
 {
     return validator.GetCompilationErrors(project);
 }
Esempio n. 5
0
 public ActionResult Validate(Project postViewModel)
 {
     var errors = Resolve<ErrorsInPostQuery>().Execute(postViewModel);
     return Json(new { status = "ok", data = errors });
 }