public void Delete(DalPicture dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "Picture is null");
     }
     Pictures entity = _context.Set<Pictures>().Include("Likes").SingleOrDefault(picture => picture.PictureId == dalEntity.Id);
     _context.Set<Pictures>().Remove(entity);
 }
 public void Create(DalPicture dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "Picture is null");
     }
     _context.Set<Pictures>().Add(new Pictures()
     {
         PictureId = dalEntity.Id,
         Name = dalEntity.Name,
         SmallPicture = dalEntity.SmallPicture,
         BigPicture = dalEntity.BigPicture,
         Description = dalEntity.Description,
         UserId = dalEntity.UserId
     });
 }
 public void Update(DalPicture dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "Picture is null");
     }
     var oldEntity = _context.Set<Pictures>().Find(dalEntity.Id);
     if (oldEntity != null)
     {
         var oldContextEntry = _context.Entry(oldEntity);
         var newEntity = new Pictures()
         {
             PictureId = dalEntity.Id,
             Name = dalEntity.Name,
             SmallPicture = dalEntity.SmallPicture,
             BigPicture = dalEntity.BigPicture,
             Description = dalEntity.Description
         };
         oldContextEntry.CurrentValues.SetValues(newEntity);
         oldContextEntry.State = EntityState.Modified;
     }
 }