public ActionResult NewCardHolder(int id) { BoardID = id; CardHolder cardHolder = new CardHolder(); cardHolder.BoardID = id; return View("CreateCardHolder", cardHolder); }
//public ActionResult PresentCardHolder(int boardId, int cardHolderId) //{ // CardHolder editCardHolder = CardHolder.getCardHolderByID(cardHolderId, boardId); // return View("CardHolder"); //} public ActionResult SaveCardHolder(CardHolder newCardHolder) { newCardHolder.BoardID = BoardID; AddCardHolderToBoard(newCardHolder); return RedirectToAction("PresentBoard", "Board", new { id = BoardID }); }
private static CardHolder copyFromDataObject(DAL.DataObjects.CardHolder dataObjCardHolder) { CardHolder newCardHolder = new CardHolder(); newCardHolder.CardHolderID = dataObjCardHolder.CardHolderID; newCardHolder.boardID = dataObjCardHolder.BoardID; newCardHolder.name = dataObjCardHolder.Name; newCardHolder.stateID = dataObjCardHolder.StateID; newCardHolder.description = dataObjCardHolder.Description; if (dataObjCardHolder.CardList != null && dataObjCardHolder.CardList.Count > 0) { newCardHolder.CardList = new List<Card>(); foreach (DAL.DataObjects.Card card in dataObjCardHolder.CardList) { newCardHolder.CardList.Add(Card.copyFromDataObject(card)); } } return newCardHolder; }
private static DAL.DataObjects.CardHolder copyToDataObject(CardHolder domainLayerCardHolder) { DAL.DataObjects.CardHolder newCardHolder = new DAL.DataObjects.CardHolder(); newCardHolder.CardHolderID = domainLayerCardHolder.CardHolderID; newCardHolder.BoardID = domainLayerCardHolder.BoardID; newCardHolder.Name = domainLayerCardHolder.Name; newCardHolder.StateID = domainLayerCardHolder.StateID; newCardHolder.Description = domainLayerCardHolder.Description; if (domainLayerCardHolder.CardList != null && domainLayerCardHolder.CardList.Count > 0) { newCardHolder.CardList = new List<DAL.DataObjects.Card>(); foreach (Card card in domainLayerCardHolder.CardList) { newCardHolder.CardList.Add(Card.copyToDataObject(card)); } } return newCardHolder; }
public static bool InsertCardHolderInBoard(int boardID, CardHolder cardHolder) { DAL.DataObjects.CardHolder newCardHolder = copyToDataObject(cardHolder); return BoardsManager.IncludeCardHolderInBoard(boardID, newCardHolder); }
private void AddCardHolderToBoard(CardHolder newCardHolder) { CardHolder.InsertCardHolderInBoard(newCardHolder.BoardID, newCardHolder); }