Ejemplo n.º 1
0
 public void UpdatePicture(DalPicture picture)
 {
     if (_context == null)
         throw new NullReferenceException("repository");
     if (picture == null)
         return ;
     if (GetCurrentUserId() == picture.UserId)
     {
         _context.Entry(picture.ToPictures()).State = EntityState.Modified;
         _context.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 public void CreatePicture(DalPicture picture, string email)
 {
     if (_context == null)
         throw new NullReferenceException("repository");
     picture.UserId = _context.Set<Users>().Single(u => u.Email == email).Id;
     _context.Set<Pictures>().Add(picture.ToPictures());
     _context.SaveChanges();
 }