public OperationResultSet <BookOfInterest> GetAllBooksOfInterestByUser(string userName, string guid) { if (!CheckAuthenticated(userName, guid)) { return(new OperationResultSet <BookOfInterest>(Library.Models.OperationResult.ErrorEnum.NotAuthenticated, "Please authenticate first!")); } using (BookOfInterestData dataProvider = new BookOfInterestData()) { try { OperationResultSet <BookOfInterest> booksOfInterest = new OperationResultSet <BookOfInterest>(new List <BookOfInterest>(dataProvider.GetAllBooksOfInterestByUser(userName))); return(booksOfInterest); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("BookManagement : GetAllBooksOfInterest : " + ex.StackTrace); return(new OperationResultSet <BookOfInterest>(Library.Models.OperationResult.ErrorEnum.InternalProblem, "Some internal problem has occured")); } } }
public OperationResult AddBookOfInterest(BookOfInterest book, string userName, string guid) { if (!CheckAuthenticated(userName, guid)) { return(new OperationResult(Library.Models.OperationResult.ErrorEnum.NotAuthenticated, "Please authenticate first!")); } if (book == null || !book.Validate()) { return(new OperationResult(Library.Models.OperationResult.ErrorEnum.InvalidInputData, "Invalid or missing book data")); } try { using (BookOfInterestData bookData = new BookOfInterestData()) { bookData.AddBookOfInterest(book); return(new OperationResult()); } } catch (Exception ex) { return(new OperationResult(Library.Models.OperationResult.ErrorEnum.InternalProblem, "Some internal problem has occured")); } }