public void SaveBoard_Should_Return() { // arrange var board = new Board { BoardId = 1, BoardName = "Syncro", Manufacturer = "Mistral", Length = Convert.ToDecimal("240"), Width = Convert.ToDecimal("65"), Volume = 115, BoardType = "Windsurfing", PurchaseDate = Convert.ToDateTime("5/30/2006"), PurchasePrice = 1499.95m, EstimatedValue = 600m, YearManufactured = 2006, PictureLocation = @"c:/abc/test.jpg" }; var sb = new Sailboard(); var retval = sb.SaveBoard(board); // assert Assert.IsTrue(retval); }
public Board GetBoard(int boardId) { var board = new Board(); using (var context = new BoardSportsDevEntity()) { var q = from b in context.Boards where b.BoardId == boardId select b; if (q.Count() == 1) { // assign the board to the object } } return board; }
public bool SaveBoard(Board board) { bool retval = false; var be = new BoardSportsDevEntity(); be.AddToBoards(board); try { be.SaveChanges(); retval = true; } catch (Exception ex) { retval = false; } return retval; }
/// <summary> /// Create a new Board object. /// </summary> /// <param name="boardId">Initial value of the BoardId property.</param> /// <param name="boardName">Initial value of the BoardName property.</param> /// <param name="manufacturer">Initial value of the Manufacturer property.</param> public static Board CreateBoard(global::System.Int32 boardId, global::System.String boardName, global::System.String manufacturer) { Board board = new Board(); board.BoardId = boardId; board.BoardName = boardName; board.Manufacturer = manufacturer; return board; }
/// <summary> /// Deprecated Method for adding a new object to the Boards EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBoards(Board board) { base.AddObject("Boards", board); }