public ActionResult Edit(ListsModel listsModel) { var list = ListDataMapper.GetListDataMapper().GetById(listsModel.Id); if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(list.Board.Id)) return RedirectToAction("Index", "Boards"); list.Name = listsModel.Name; return RedirectToAction("GetLists", "Boards", new {id = list.Board.Id}); }
public ActionResult CreateList(ListsModel listsModel, int id) { var board = BoardDataMapper.GetBoardDataMapper().GetById(id); if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(board.Id)) return RedirectToAction("Index"); listsModel.Board = board; var ldm = ListDataMapper.GetListDataMapper(); ldm.Add(listsModel); return Redirect(String.Format("~/Boards/GetLists/{0}", id)); }
public ActionResult RemoveList(ListsModel listsModel) { var list = ListDataMapper.GetListDataMapper().GetById(listsModel.Id); int boardId = list.Board.Id; if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(boardId)) return RedirectToAction("Index", "Boards"); ListDataMapper.GetListDataMapper().Remove(list); return RedirectToAction("GetLists", "Boards", new { id = boardId }); }