Example #1
0
        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());
            }
        }
Example #2
0
 public static Covers ToOrmCover(this DalCover cover)
 {
     return(new Covers
     {
         CoverID = cover.ID,
         BookID = cover.BookID,
         Path = cover.ImagePath
     });
 }
Example #3
0
        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
     });
 }