public ActionResult Add(String bookId, String userId) { try { int userid = Convert.ToInt32(userId); int bookid = Convert.ToInt32(bookId); IBookRequestService bookRequestService = new BookRequestService(); IUserBookRequestService userBookRequestService = new UserBookRequestService(); Boolean bookRequestStatus = bookRequestService.Add(bookid); Boolean userBookRequestStatus = userBookRequestService.Add(userid, bookid); if ((bookRequestStatus && userBookRequestStatus).Equals(true)) { return Content("Success"); } return Content("Failed"); } catch (Exception e) { Console.WriteLine("Error in BookRequestController , Add()"); Console.Write(e.ToString()); return Content("Failed"); } }
// [TestMethod] public void TestAdd() { IUserBookRequestService userBookRequestService = new UserBookRequestService(); Boolean status = userBookRequestService.Add(23, 1); Assert.IsTrue(status); }