Beispiel #1
0
 /// <summary>
 /// This method is used to do action on friend request
 /// </summary>
 /// <returns></returns>
 public OperationStatus ActionOnFriendRequest(ApplicationFriendAssociationModel objAssociation)
 {
     using (_IAssociationRepo = new ApplicationFriendAssociationRepo())
     {
         return(_IAssociationRepo.ActionOnFriendRequest(objAssociation));
     }
 }
        public OperationStatus AddFriendRequest(ApplicationFriendAssociationModel objAssociation)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new ChatApplicationEntities())
                {
                    if (objAssociation.ApplicationFriendAssociationId == 0)
                    {
                        var rs = dbcontext.tblApplicationFriendAssociations.FirstOrDefault(x => x.MemberId == objAssociation.MemberId && x.FriendId == objAssociation.FriendId && x.IsDeleted == false);
                        if (rs == null)
                        {
                            tblApplicationFriendAssociation _addAssociation = new tblApplicationFriendAssociation
                            {
                                MemberId     = objAssociation.MemberId,
                                FriendId     = objAssociation.FriendId,
                                RequestBy    = objAssociation.RequestBy,
                                IsConfirm    = 2,
                                IsActive     = true,
                                IsDeleted    = false,
                                CreatedDate  = DateTime.Now,
                                CreatedBy    = objAssociation.CreatedBy,
                                ModifiedDate = DateTime.Now,
                                ModifiedBy   = objAssociation.ModifiedBy,
                            };
                            dbcontext.tblApplicationFriendAssociations.Add(_addAssociation);
                            dbcontext.SaveChanges();

                            status = OperationStatus.Success;
                        }
                        else
                        {
                            status = OperationStatus.Duplicate;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
 public Response AddFriendRequest(ApplicationFriendAssociationModel objAssociation)
 {
     _response = new Response();
     try
     {
         IApplicationFriendAssociationBusiness applicationFriendService = new ApplicationFriendAssociationBusiness();
         _response.responseData = applicationFriendService.AddFriendRequest(objAssociation);
         _response.message      = "Request send successfully !!";
         _response.success      = true;
     }
     catch (Exception ex)
     {
         _response.success = false;
         _response.message = ex.Message.ToString();
     }
     finally
     {
         applicationFriendService = null;
     }
     return(_response);
 }
        public OperationStatus ActionOnFriendRequest(ApplicationFriendAssociationModel objAssociation)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new ChatApplicationEntities())
                {
                    if (objAssociation.ApplicationFriendAssociationId != 0 && objAssociation.Status != string.Empty)
                    {
                        var rs = dbcontext.tblApplicationFriendAssociations.FirstOrDefault(x => x.ApplicationFriendAssociationId == objAssociation.ApplicationFriendAssociationId && x.IsActive == true && x.IsDeleted == false);
                        if (rs != null)
                        {
                            rs.IsConfirm    = objAssociation.Status == "Accept" ? 1 : 3;
                            rs.CreatedDate  = DateTime.Now;
                            rs.CreatedBy    = objAssociation.CreatedBy;
                            rs.ModifiedDate = DateTime.Now;
                            rs.ModifiedBy   = objAssociation.ModifiedBy;

                            dbcontext.SaveChanges();

                            status = OperationStatus.Success;
                        }
                        else
                        {
                            status = OperationStatus.Duplicate;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }