public ListView(BList l, IEnumerable<Card> c) : base("LIST - " + l.Id.ToString() + "do Board - " + l.IdBoard.ToString(), H1(Text("List: " + l.Name)), H2(Text("Description: ")), P (Text(l.Description)), Ul( c.Select(lst => Li(A(ResolveUri.ForCard(lst), lst.Name))).ToArray() ), P(), A("http://localhost:8080/boards/" + l.IdBoard, "Back to Board Viewer"), P(), A(ResolveUri.ForBoards(), "Back to Board Manager"), H2(Text("Change Description")), Form("post", "/boards/" + l.Id + "/lists/" + l.Id, Label("changeDesc", "Description: "), InputText("changeDesc") ), H2(Text("Create a new card")), Form("post", "/boards/" + l.IdBoard + "/lists/" + l.Id + "/cards", Label("name", "Name: "), InputText("name") ), H2(Form("post", "/boards/" + l.IdBoard + "/lists/" + l.Id + "/delete", InputSubmit("Remove List") )), H2(Form("post", "/boards/" + l.IdBoard + "/lists/" + l.Id + "/up", InputSubmit("Move Up") )), H2(Form("post", "/boards/" + l.IdBoard + "/lists/" + l.Id + "/down", InputSubmit("Mode Down") ))) { }
public HttpResponseMessage CreateList(NameValueCollection content, int id) { Board td = _repo.GetById(id); if (td == null) { return new HttpResponseMessage(HttpStatusCode.BadRequest); } var name = content["name"]; if (name == null) { return new HttpResponseMessage(HttpStatusCode.BadRequest); } foreach (BList lst in _repoList.GetAllByBoardId(id)) { if (lst.Name == name) return new HttpResponseMessage(HttpStatusCode.BadRequest); } var l = new BList { Name = name }; _repoList.Add(l, td.Id); //td.lists.Add(l); // adiciona a lista ao contentor de listas da board var resp = new HttpResponseMessage(HttpStatusCode.SeeOther); resp.Headers.Location = new Uri(ResolveUri.ForList(l)); return resp; }
// iv - 2012.10.20 // novo método // permite mostrar a lista arquivada public static string ForArchiveList(Board b, BList l) { return string.Format("http://localhost:8080/boards/{0}/archive/{1}", b.Id, l.IdArchive); }
/* // mostra todas as lista de um board public static string ForLists(Boards td) { return string.Format("http://localhost:8080/boards/{0}/lists", td.Id); }*/ // mostra uma lista de um determinado board public static string ForList(BList l) { return string.Format("http://localhost:8080/boards/{0}/lists/{1}",l.IdBoard, l.Id); }
// dm - 2012.10.20 //novo metodo //permite mover a lista uma posição para baixo public static string MoveDown(BList l) { return string.Format("http://localhost:8080/boards/{0}/lists/{1}/down", l.IdBoard, l.Id); }
// iv - 2012.11.11 public void Add(string name, int idBoard) { BList l = new BList { Id = _cid, IdBoard = idBoard, Name = name }; _repo.Add(_cid++, l); }
//2012.10.21 - David public void Add(BList l, string BoardN) { l.Id = _cid; _repo.Add(_cid++, l); }
/*public BList GetById(int idBoard, int id) { BList list = null; _repo.TryGetValue(id, out list); return list; }*/ public void Add(BList l, int idBoard) { l.IdBoard = idBoard; l.Id = _cid; _repo.Add(_cid++,l); }
//iv - 2012.11.11 /*public void Remove(int id) { if (_repo.Count > 0) { foreach (var bList in _repo) { if (bList.Value.Id == id) { _repo.Remove(bList.Key); break; } } } //_repo.Remove(id); }*/ // iv - 2012.11.13 public void Remove(BList l) { _repo.Remove(l.Id); }