Ejemplo n.º 1
0
 public void CreateLike(Like like)
 {
     if(like == null)
     {
         throw new ArgumentNullException("like");
     }
     dbContext.Likes.Add(like);
 }
Ejemplo n.º 2
0
        public void UpdateLike(Like like)
        {
            if(like == null)
               {
               throw new ArgumentNullException("like");
               }

            var existLike = dbContext.Likes.FirstOrDefault(x => x.LikeId == like.LikeId);
            if(existLike == null)
            {
                throw new InvalidDataException("this like doesn't exist in current data base");
            }
            CopyLikeProperties(like,existLike);
        }
Ejemplo n.º 3
0
 private void CopyLikeProperties(Like fromLike, Like toLike)
 {
     if(fromLike == null)
     {
         throw new ArgumentNullException("fromLike");
     }
     if (toLike == null)
     {
         throw new ArgumentNullException("toLike");
     }
     toLike.CreateDate = fromLike.CreateDate;
     toLike.PresentationId = fromLike.PresentationId;
     toLike.UserId = fromLike.UserId;
 }
Ejemplo n.º 4
0
 public void DeleteLike(Like like)
 {
     if(like == null)
     {
         throw new ArgumentNullException("like");
     }
     var existLike = dbContext.Likes.FirstOrDefault(x => x.LikeId == like.LikeId);
     if(existLike == null)
     {
         throw new InvalidDataException("this like doesn't exist in the current data base");
     }
     dbContext.Likes.Remove(existLike);
 }