Esempio n. 1
0
        public ActionResult Create(int id)
        {
            var ws = new WorkspaceService();
            if (!ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, id))
                return RedirectToAction("Index", "Workspace");

            return View(new CreateForm {WorkspaceId = id});
        }
Esempio n. 2
0
        public ActionResult Edit(int id)
        {
            var ws = new WorkspaceService();
            var workspace = ws.GetWorkspace(id);
            if (workspace != null && ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, id))
                return View(new Form() {Workspace = workspace, IsEditing = true});

            this.SetTempMessage("You can't see this page.", "error");
            return RedirectToAction("Index");
        }
Esempio n. 3
0
 public ActionResult Edit(Form form)
 {
     var ws = new WorkspaceService();
     if (ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, form.Workspace.Id))
     {
         ws.UpdateWorkspace(form.Workspace);
         this.SetTempMessage("Workspace has been updated.", "success");
     }
     return RedirectToAction("Index");
 }
Esempio n. 4
0
 public ActionResult Delete(int id)
 {
     var ws = new WorkspaceService();
     if (ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, id))
     {
         ws.DeleteWorkspace(id);
         this.SetTempMessage("Workspace has been deleted.", "success");
     }
     return RedirectToAction("Index");
 }
Esempio n. 5
0
        public ActionResult Create(CreateForm p)
        {
            var ws = new WorkspaceService();
            if (!ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, p.WorkspaceId))
                return RedirectToAction("Index", "Workspace");

            if (!ModelState.IsValid) return View(p);

            int projectId = new ProjectService().CreateProject(p.Name, p.WorkspaceId, SessionStorage.User.Id,
                                                               p.Description);

            return RedirectToAction("Show", "Project", new { id = projectId });
        }