Example #1
0
 public void DeleteHousePic(long housePicId)
 {
     using (WarmHomeContext db = new WarmHomeContext())
     {
         HousepicEntity entity = new HousepicEntity();
         entity.Id = housePicId;
         db.Entry(entity).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Example #2
0
        public long AddNewHousePic(HousePicDTO housePic)
        {
            HousepicEntity hpEntity = new HousepicEntity();

            hpEntity.HouseId  = housePic.HouseId;
            hpEntity.ThumbUrl = housePic.ThumbUrl;
            hpEntity.Url      = housePic.Url;
            using (MyDbContext ctx = new MyDbContext())
            {
                ctx.Housepics.Add(hpEntity);
                ctx.SaveChanges();
                return(hpEntity.Id);
            }
        }
Example #3
0
 public long AddNewHousePic(HousePicDTO housePic)
 {
     using (WarmHomeContext db = new  WarmHomeContext())
     {
         HousepicEntity entity = new HousepicEntity()
         {
             ThumbUrl = housePic.ThumbUrl,
             Url      = housePic.Url,
             HouseId  = housePic.HouseId
         };
         db.Housepics.Add(entity);
         db.SaveChanges();
         return(entity.Id);
     }
 }