public void ConfirmRequest(FriendBM frnd) { FriendBL frnbl = new FriendBL(); //cast list to ienumearble call create Friend req frnbl.ConfirmFriendRequest(frnd); }
public void DeleteFriend(FriendBM frndbm) { List<Friend> frndList = uow.FriendRepository.Find(x => x.UserId == frndbm.UserId && x.FriendId == frndbm.FriendId || x.UserId == frndbm.FriendId && x.FriendId == frndbm.UserId); foreach (var item in frndList) { uow.FriendRepository.Delete(item); uow.Save(); } }
public void ConfirmFriendRequest(FriendBM frndbm) { ProWorldzContext context = new ProWorldzContext(); List<Friend> frndList = uow.FriendRepository.Find(x => x.UserId == frndbm.UserId && x.FriendId == frndbm.FriendId || x.UserId == frndbm.FriendId && x.FriendId == frndbm.UserId ); foreach (var item in frndList) { item.FriendShipStatusId = (int)FriendShipStatus.Accepted; uow.FriendRepository.Update(item); uow.Save(); } }
public void AddFriend(FriendBM frnd) { FriendBL frnbl = new FriendBL(); List<FriendBM> lsFrndReq = new List<FriendBM>(); frnd.CreationDate = DateTime.Now; frnd.FriendShipStatusId = (int)FriendShipStatus.Pending; lsFrndReq.Add(frnd); lsFrndReq.Add(GetOtherBM(frnd)); //cast list to ienumearble call create Friend req frnbl.CreateFriendrequest(lsFrndReq); }
public void DeleteFriend(FriendBM frnd) { FriendBL frnbl = new FriendBL(); frnbl.DeleteFriend(frnd); }
public FriendBM GetOtherBM(FriendBM frnd) { FriendBM frndbm = new FriendBM(); frndbm.CreationDate = frnd.CreationDate; frndbm.FriendId = frnd.UserId; frndbm.UserId = frnd.FriendId; frndbm.FriendShipStatusId = (int)FriendShipStatus.New; return frndbm; }
public void Delete(FriendBM model) { uow.FriendRepository.Delete(ConvertToDM(model)); uow.Save(); }
public void Create(FriendBM model) { uow.FriendRepository.Add(ConvertToDM(model)); uow.Save(); }
private FriendBM ConvertToFriendBM(UserBM model) { UserGeneralInformationBL userGeneralInfoBL = new UserGeneralInformationBL(); UserGeneralInformationBM userGeneralInfoBM=new UserGeneralInformationBM(); userGeneralInfoBM=userGeneralInfoBL.GetGeneralInformationByUserId(model.Id); FriendBM frnd = new FriendBM(); frnd.UserId = CurrentUser; frnd.FriendName = model.Name; frnd.FriendCommunity = model.CommunityName; if (userGeneralInfoBM != null) frnd.FriendImage = string.IsNullOrEmpty(userGeneralInfoBM.Image) ? null : userGeneralInfoBM.Image; var friend = uow.FriendRepository.Find(x => x.UserId == CurrentUser && x.FriendId == model.Id).FirstOrDefault(); if (friend == null) { frnd.FriendId = model.Id; frnd.FriendShipStatusId = 0; } else { frnd.Id = friend.Id; frnd.FriendShipStatusId = friend.FriendShipStatusId; frnd.FriendId = friend.FriendId; frnd.CreationDate = friend.CreationDate; } return frnd; }
private Friend ConvertToDM(FriendBM model) { return new Friend { CreationDate = model.CreationDate, FriendShipStatusId = model.FriendShipStatusId, FriendId = model.FriendId, UserId = model.UserId }; }