public ActionResult Create(BoardsModel boardsModel) { var bm = BoardDataMapper.GetBoardDataMapper(); if (bm.GetByName(boardsModel.Name) == null){ bm.Add(boardsModel); var acc = AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name); acc.AddBoard(boardsModel); return RedirectToAction("Index"); } ModelState.AddModelError("Name", "Já existe um Quadro com esse nome"); return View(boardsModel); }
public void RemoveBoard(BoardsModel bm) { RemoveReadBoard(bm.Id); RemoveWriteBoard(bm.Id); }
public void AddBoard(BoardsModel bm) { AddReadBoard(bm.Id); AddWriteBoard(bm.Id); }
public ActionResult Edit(BoardsModel boardsModel) { var board = BoardDataMapper.GetBoardDataMapper().GetById(boardsModel.Id); if (board == null) return RedirectToAction("Http404", "Errors"); if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(board.Id)) return RedirectToAction("Index"); board.Name = boardsModel.Name; board.Description = boardsModel.Description; return RedirectToAction("Index"); }