Exemplo n.º 1
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"));
        }
Exemplo n.º 2
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"));
        }
Exemplo n.º 3
0
        public ActionResult Show(int id)
        {
            var ws        = new WorkspaceService();
            var workspace = ws.GetWorkspace(id);

            if (workspace != null && ws.IsUserCanInteractWithWorkspace(SessionStorage.User.Id, id))
            {
                return(View(workspace));
            }

            this.SetTempMessage("You can't see this page.", "error");
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
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
            }));
        }
Exemplo 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 }));
        }