public bool CreateIssuance(IssuanceOfBooksViewModel book) { bool status; if (!ModelState.IsValid) { return(false); } try { var issuanceOfBooksDto = new IssuanceOfBooksDto() { ReturnDate = book.ReturnDate, DateIssue = book.DateIssue, CatalogBooksId = book.CatalogBooksId, Id = book.Id }; status = _libraryService.CreateIssuance(issuanceOfBooksDto); } catch (System.Exception) { status = false; } return(status); }
public bool CreateIssuance(IssuanceOfBooksDto issuanceOfBooksDto) { bool status; try { var issuance = new IssuanceOfBooks { CatalogBooksId = issuanceOfBooksDto.CatalogBooksId, DateIssue = issuanceOfBooksDto.DateIssue, ReturnDate = issuanceOfBooksDto.ReturnDate, Id = issuanceOfBooksDto.Id }; Database.IssuanceOfBooks.Create(issuance); Database.Save(); status = true; } catch (Exception) { status = false; } return(status); }