public static BookComment ToEntity(this BookCommentModel model) { var entity = new BookComment() { Id = model.Id, BookId = model.BookId, UserId = model.UserId, Comment = model.Comment, Rating = model.Rating, CreatedDate = model.CreatedDate }; return(entity); }
public static BookCommentModel ToModel(this BookComment entity) { var model = new BookCommentModel() { Id = entity.Id, BookId = entity.BookId, UserId = entity.UserId, Comment = entity.Comment, Rating = entity.Rating.HasValue ? entity.Rating.Value : 0, CreatedDate = entity.CreatedDate }; return(model); }