Ejemplo n.º 1
0
 public FriendRelationshiop Update(FriendRelationshiop friendRelationship)
 {
     using (var _ctx = new ApplicationDbContext())
     {
         _ctx.Entry(friendRelationship).State = EntityState.Modified;
         _ctx.SaveChanges();
         return(friendRelationship);
     }
 }
Ejemplo n.º 2
0
 //Update friendProfile
 public FriendRelationshiop Update(FriendRelationshiop friendProfile)
 {
     try
     {
         return(_friendRepository.Update(friendProfile));
     }
     catch (Exception e)
     {
         throw new Exception("Error - update the user's friend.");
     }
 }
Ejemplo n.º 3
0
 //Add friendProfile
 public FriendRelationshiop Add(FriendRelationshiop friendProfile)
 {
     try
     {
         return(_friendRepository.Add(friendProfile));
     }
     catch (Exception e)
     {
         throw new Exception("Error - add the user's friend.");
     }
 }
Ejemplo n.º 4
0
 public FriendRelationshiop Add(FriendRelationshiop friendRelationship)
 {
     using (var _ctx = new ApplicationDbContext())
     {
         var foundFriend = _ctx.Set <FriendRelationshiop>().Any(x => x.FriendUserProfileId == friendRelationship.FriendUserProfileId && x.UserProfileId == friendRelationship.UserProfileId);
         if (!foundFriend)
         {
             _ctx.Entry(friendRelationship).State = EntityState.Added;
             _ctx.SaveChanges();
         }
         return(friendRelationship);
     }
 }