public void AddCover(DalBook book, DalCover cover) { var dbBook = context.Books.FirstOrDefault(e => e.BookID == book.ID); if (dbBook != null) { context.Covers.Add(cover.ToOrmCover()); } }
public static Covers ToOrmCover(this DalCover cover) { return(new Covers { CoverID = cover.ID, BookID = cover.BookID, Path = cover.ImagePath }); }
public void DeleteCover(DalCover cover) { var dbCover = context.Covers.FirstOrDefault(e => e.CoverID == cover.ID); if (dbCover != null) { context.Covers.Remove(dbCover); } }
public static ServiceCover ToServiceCover(this DalCover cover) { return(new ServiceCover { ID = cover.ID, BookID = cover.BookID, ImagePath = cover.ImagePath }); }