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}); }
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"); }
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"); }
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"); }
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 }); }