public ActionResult GetLiked(int[] ids)
        {
            if (CurrentSession.User != null)
            {
                int        userid       = CurrentSession.User.Id;
                List <int> likedNoteIds = new List <int>();

                if (ids != null)
                {
                    likedNoteIds = likedManager.List(
                        x => x.LikedUser.Id == userid && ids.Contains(x.Note.Id)).Select(
                        x => x.Note.Id).ToList();
                }
                else
                {
                    likedNoteIds = likedManager.List(
                        x => x.LikedUser.Id == userid).Select(
                        x => x.Note.Id).ToList();
                }

                return(Json(new { result = likedNoteIds }));
            }
            else
            {
                return(Json(new { result = new List <int>() }));
            }
        }
Example #2
0
        public ActionResult GetLiked(int[] ids)
        {
            if (ids != null)
            {
                List <int> likedNoteIds = likedManager.List(x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Book.Id)).Select(
                    x => x.Book.Id).ToList();

                return(Json(new { result = likedNoteIds }));
            }
            return(null);
        }
        public ActionResult GetLiked(int[] ids)
        {
            //Kullanıcının likeladığı notları çekip ids (likelananlar) bunlardan birini içeriyor mu ? İçerenlerin idsini al.
            List <int> likedNotesIds = likedManager.List(x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Note.Id)).Select(x => x.Note.Id).ToList();

            return(Json(new { result = likedNotesIds }));
        }
Example #4
0
        public ActionResult GetLiked(int[] ids)
        {
            List <int> likedNote = likedManager.List(x => x.LikedUser.ID == CSession.User.ID && ids.Contains(x.Note.ID)).Select(x => x.Note.ID).ToList();


            return(Json(new { data = likedNote }));
        }
Example #5
0
        public ActionResult GetLiked(int[] ids)
        {
            List <int> likedShareeIds = likedManager.List
                                            (x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains
                                                (x.Share.Id)).Select(x => x.Share.Id)
                                        .ToList();

            return(Json(new { result = likedShareeIds }));
        }
Example #6
0
        public ActionResult GetLiked(int[] ids)
        {
            if (CurrentSession.User != null)
            {
                List <int> LikedNoteIds = liked_mngr.List(x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Articles.Id)).Select(x => x.Articles.Id).ToList();

                return(Json(new { result = LikedNoteIds }));
            }
            List <int> empty = null;

            return(Json(new { result = empty }));
        }
 public ActionResult GetLiked(int[] ids)
 {
     if (CurrentSession.User != null)
     {
         List <int> likedNoteIds = likedManager.List(x => x.LikedUser.ID == CurrentSession.User.ID && ids.Contains(x.Note.ID)).Select(
             x => x.Note.ID).ToList();
         return(Json(new { result = likedNoteIds }));
     }
     else
     {
         return(Json(new { result = new List <int>() }));
     }
 }
Example #8
0
        public ActionResult GetLiked(int[] IdArrays)
        {
            if (CurrentSession.User != null)
            {
                List <int> liketNoteIds = likedManager.List(
                    q => q.LikedUser.Id == CurrentSession.User.Id &&
                    IdArrays.Contains(q.Note.Id)).
                                          Select(q => q.Note.Id).ToList();

                return(Json(new { result = liketNoteIds }));
            }
            return(Json(new { result = new List <int>() }));
        }
Example #9
0
        public ActionResult GetLiked(int[] ids)
        {
            if (SessionHelper.User != null)
            {
                List <int> likedNoteIds = lm.List(
                    x => x.LikedUser.Id == SessionHelper.User.Id && ids.Contains(x.Note.Id)).Select(
                    x => x.Note.Id).ToList();

                return(Json(new { result = likedNoteIds }));
            }
            else
            {
                return(Json(new { result = new List <int>() }));
            }
        }
        public ActionResult GetLiked(int[] ids)
        {
            //o sayfadaki not id'lerin içinden o anki kullanıcının beğendiği notları geri dönderir.
            if (CurrentSession.User != null)
            {
                List <int> likedNoteIds = lm.List(
                    x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Note.Id)).Select(
                    x => x.Note.Id).ToList();

                return(Json(new { result = likedNoteIds }));
            }
            else
            {
                return(Json(new { result = new List <int>() }));
            }
        }
Example #11
0
        public ActionResult GetLiked(int[] ids)
        {
            if (CurrentSession.User != null)
            {
                //kullanıcının begendiği notların id lerini döndür
                List <int> likedNoteIds = likedManager.List(

                    x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Note.Id)).Select(x => x.Note.Id).ToList();//şuan login olan kullanıcının likelar
                //Conations--> o deger iceriyo bu notun id si


                return(Json(new { result = likedNoteIds }));
            }
            else
            {
                return(Json(new { result = new List <int>() }));
            }
        }
        public ActionResult GetLiked(int[] ids)
        {
            if (CurrentSession.User != null)
            {
                //Şuan içerisindeki Sessionda kullanıcıların like'ını getir
                //&& ve notların id parametreleri ids dizinde ile geliyor,bu liste içeriyor mu Notun id sini
                //Bana daha sonra notların id sini verip Listeye dönüştürüyorum
                List <int> likedNoteIds = likedManager.List(
                    x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Note.Id)).Select(
                    x => x.Note.Id).ToList();

                return(Json(new { result = likedNoteIds }));
            }
            else
            {
                return(Json(new { result = new List <int>() }));
            }
        }
Example #13
0
        public ActionResult GetLiked(int[] noteIdList)
        {
            if (noteIdList == null || noteIdList.Length <= 0)
            {
                return(null);
            }

            // Örnek sorgu - 1
            //List<int> likedNoteIdList = (from liked in likedManager.QueryableList()
            //                            where noteIdList.Contains(liked.Note.Id) && liked.LikedUser.Id == CurrentSession.User.Id
            //                            select liked.Note.Id).ToList();

            // Örnek Sorgu - 2
            List <int> likedNoteIdList = likedManager.List(
                x => x.LikedUser.Id == CurrentSession.User.Id && noteIdList.Contains(x.Note.Id)).Select(
                x => x.Note.Id).ToList();

            return(Json(new { result = likedNoteIdList }, JsonRequestBehavior.AllowGet));
        }
Example #14
0
        public ActionResult GetLiked(int[] getdizi)
        {
            //List<int> likedNoteIds = likedManager.List(x => x.LikedUser.Id == CurrentSession.User.Id && ids.Contains(x.Note.Id)).Select(x => x.Note.Id).ToList();//kullanıcını likedladığı note'ların idleri

            if (CurrentSession.User == null)
            {
                return(null);
            }
            if (getdizi == null)
            {
                return(null);
            }

            //çoka çok tablodan veri çekme
            List <int> likedNoteIds = likedManager.List().Where(x => x.LikedUser.Id == CurrentSession.User.Id && getdizi.Contains(x.Note.Id)).Select(x => x.Note.Id).ToList();//kullanıcını likedladığı note'ların idleri



            return(Json(new { result = likedNoteIds }));//json döndürdük.
        }
Example #15
0
        public ActionResult GetLiked(int?[] ids)
        {
            using (LikedManager likedManager = new LikedManager())
            {
                List <int> likedSharingId = new List <int>();
                if (ids != null)
                {
                    if (CurrentSession.shareBookUser != null)
                    {
                        likedSharingId = likedManager.List(x => x.likedUser.Id == CurrentSession.shareBookUser.Id && ids.Contains(x.Shareing.Id)).Where(x => !x.likedUser.isDeleted).Select(x => x.Shareing.Id).ToList();

                        return(Json(new { Result = likedSharingId }));
                    }

                    return(Json(new { Result = likedSharingId }));
                }
                else
                {
                    return(Json(new { Result = likedSharingId }));
                }
            }
        }
Example #16
0
        public ActionResult Kitap(int Id)
        {
            // new AprioriProcess().CreateAprioriRules();
            if (Id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            bookSessionInfoManager.SaveBookInfo(Id);

            BookViewModel model = null;

            try
            {
                Book book = bookManager.ListQueryable().Include("Comments").Where(x => x.Id == Id).FirstOrDefault();

                if (book != null)
                {
                    model = new BookViewModel()
                    {
                        Id          = book.Id,
                        Name        = book.Name,
                        Author      = book.Author.IsActive == true ? book.Author.Name : "",
                        Description = book.Description,
                        Page        = book.Page,
                        Publisher   = book.Publisher.IsActive == true ? book.Publisher.Name : "",
                        Year        = book.Year,
                        Comments    = book.Comments
                    };

                    int page = commentManager.List().Where(x => x.Book.Id == Id).Count();
                    if (page % 3 == 0)
                    {
                        ViewBag.PageCount = page / 3;
                    }
                    else
                    {
                        ViewBag.PageCount = page / 3 + 1;
                    }

                    var bookSumPoint = likedManager.List().Where(x => x.Book.Id == Id).Sum(x => x.Point);

                    var bookLikeCount = bookManager.List().Where(x => x.Id == Id).Select(x => x.LikeCount).First();
                    if (bookLikeCount != 0)
                    {
                        model.Point = ((float)bookSumPoint / bookLikeCount).ToString("0.#");
                    }
                    else
                    {
                        model.Point = "0";
                    }
                    book.Clicked++;
                    bookManager.Update(book);


                    return(View(model));
                }
            }
            catch (Exception ex)
            {
                ErrorViewModel errorNotifyObj = new ErrorViewModel()
                {
                    Title          = "Aradığınız kitap bilgisine ulaşılırken bir hata oluştu.Anasayfaya yönlendiriliyorsunuz...",
                    RedirectingUrl = "/Home/Index"
                };
                return(View("Error", errorNotifyObj));
            }
            return(View(model));
        }