public ActionResult Oylamalarim() { VotedressUser user = new VotedressUser(); user = Session["login"] as VotedressUser; OylamaManager oylamaManager = new OylamaManager(); OylamalarimViewModel oylamalarimViewModel = new OylamalarimViewModel(); oylamalarimViewModel = oylamaManager.OylamalarimSayfasi(user.id); return(View(oylamalarimViewModel)); }
public OylamalarimViewModel OylamalarimSayfasi(Guid kullanici_id) { List <Vote> oylama = OylamalarimiGetir(kullanici_id); if (oylama.Count != 0) { DateTime enBuyukTarih = oylama.Max(x => x.StartTime); Vote vote = oylama.Where(x => x.StartTime == enBuyukTarih).FirstOrDefault(); if (oylama.Count != 0) { Vote_sade vote_sade = new Vote_sade(); vote_sade.id = vote.id; vote_sade.PaylasimaAcikmi = vote.PaylasimaAcikmi; vote_sade.ProfilGorunsunMu = vote.ProfilGorunsunMu; vote_sade.StartTime = vote.StartTime; vote_sade.TypeOfVote = vote.TypeOfVote; vote_sade.VoteLink = vote.VoteLink; vote_sade.FinishTime = vote.FinishTime; vote_sade.OylamaUrunleri = vote.VoteProduct.Select(x => new VoteProduct_sade() { id = x.id, ProductId = x.Product.id, ProductName = x.Product.ProductName, ProductImage = x.Product.ProductImage, Price = x.Product.Price, IsForSale = x.Product.IsForSale, VoteCount = x.VoteCount, LongDescription = x.Product.LongDescription, ShortDescription = x.Product.ShortDescription, UrunSahibi = new Magazalar_sade() { MagazaGuid = x.Product.User.id, SirketAdi = x.Product.User.UserDetail.CompanyName, SirketResmi = x.Product.User.ProfileImage, TelNo = x.Product.User.UserDetail.PhoneNumber, Email = x.Product.User.Email, WebSite = "www.deneme.com", MagazadakilerSayisi = x.Product.User.OnlineCount, Sehir = x.Product.User.UserDetail.City.CityName, Ilce = x.Product.User.UserDetail.County.CountyName, Mahalle = x.Product.User.UserDetail.Neighborhood.NeighborhoodName, Adres = x.Product.User.UserDetail.AdressDetail, FranchiseAdi = x.Product.User.Franchise.FranchiseName, FranchiseLogo = x.Product.User.Franchise.FranchiseLogo, }, OylamaResimleri = x.VoteImages.Select(t => new VoteImage_sade() { id = t.id, Aciklama = t.Aciklama, ImageNo = t.ImageNo, ImagePath = t.ImagePath }).ToList() }).ToList(); vote_sade.OylamaSahibi.id = vote.User.id; vote_sade.OylamaSahibi.Name = vote.User.UserDetail.Name; vote_sade.OylamaSahibi.SurName = vote.User.UserDetail.SurName; vote_sade.OylamaSahibi.Email = vote.User.Email; vote_sade.OylamaSahibi.Birthday = vote.User.UserDetail.Birthday; vote_sade.OylamaSahibi.Sex = vote.User.UserDetail.Sex; vote_sade.OylamaSahibi.ProfileImage = vote.User.ProfileImage; vote_sade.OylamaSahibi.SocialId = vote.User.SocialId; vote_sade.OylamaSahibi.SocialName = vote.User.SocialName; if (vote.VoteMessage != null) { VoteMessage_sade voteMessage_sade; for (int i = 0; i < vote.VoteMessage.Count; i++) { voteMessage_sade = new VoteMessage_sade(); voteMessage_sade.id = vote.VoteMessage[i].id; voteMessage_sade.Message = vote.VoteMessage[i].Message; voteMessage_sade.GondermeTarihi = vote.VoteMessage[i].GondermeTarihi; voteMessage_sade.MesajSahibi.id = vote.VoteMessage[i].User.id; voteMessage_sade.MesajSahibi.Name = vote.VoteMessage[i].User.UserDetail.Name; voteMessage_sade.MesajSahibi.ProfileImage = vote.VoteMessage[i].User.ProfileImage; voteMessage_sade.MesajSahibi.Sex = vote.VoteMessage[i].User.UserDetail.Sex; voteMessage_sade.MesajSahibi.SocialId = vote.VoteMessage[i].User.SocialId; voteMessage_sade.MesajSahibi.SocialName = vote.VoteMessage[i].User.SocialName; voteMessage_sade.MesajSahibi.SurName = vote.VoteMessage[i].User.UserDetail.SurName; voteMessage_sade.MesajSahibi.Email = vote.VoteMessage[i].User.Email; voteMessage_sade.MesajSahibi.Birthday = vote.VoteMessage[i].User.UserDetail.Birthday; vote_sade.OylamaMesajlari.Add(voteMessage_sade); } } InVoteChatManager invotechatManager = new InVoteChatManager(); vote_sade.Chattekiler = invotechatManager.ChattekileriGetir(vote.id); vote_sade.SessionUserId = kullanici_id; OylamalarimViewModel oylamalarimViewModel = new OylamalarimViewModel(); oylamalarimViewModel.vote_Sade = vote_sade; oylamalarimViewModel.oylamalarimModels = oylama.OrderByDescending(x => x.StartTime).Select(x => new OylamalarimModel() { OylamaId = x.id, OylamaBaslangicZamani = x.StartTime, OylamaBitisZamani = x.FinishTime, OylamaDurumu = x.FinishTime < DateTime.Now ? true : false }).ToList(); return(oylamalarimViewModel); } } return(null); }