public void Delete(DalUser dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "User is null");
     }
     Users entity =
         _context.Set<Users>()
             .Include("Pictures")
             .Include("Likes")
             .SingleOrDefault(user => user.UserId == dalEntity.Id);
     _context.Set<Users>().Remove(entity);
 }
 public void Create(DalUser dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "User is null");
     }
     _context.Set<Users>().Add(new Users()
     {
         UserId = dalEntity.Id,
         Name = dalEntity.Name,
         Email = dalEntity.Email,
         Password = dalEntity.Password,
         RoleId = dalEntity.RoleId,
         Avatar = dalEntity.Avatar
     });
 }
 public void Update(DalUser dalEntity)
 {
     if (dalEntity == null)
     {
         throw new ArgumentNullException("dalEntity", "User is null");
     }
     var oldEntity = _context.Set<Users>().Find(dalEntity.Id);
     if (oldEntity != null)
     {
         var oldContextEntry = _context.Entry(oldEntity);
         Users newEntity = new Users()
         {
             UserId = dalEntity.Id,
             Name = dalEntity.Name,
             Email = dalEntity.Email,
             Password = dalEntity.Password,
             RoleId = dalEntity.RoleId,
             Avatar = dalEntity.Avatar
         };
         oldContextEntry.CurrentValues.SetValues(newEntity);
         oldContextEntry.State = EntityState.Modified;
     }
 }