public override void Process(TagHelperContext context, TagHelperOutput output) { List <Book> userbooks = _bookAppUserService.GetByAppUserId(AppUserId); int bookCount = userbooks.Count(); string htmlString = $"{bookCount} <span>Kitap Sayısı</span>"; output.Content.SetHtmlContent(htmlString); }
private List <SelectListItem> GetAppUserBookSelectListItems() { var result = new List <SelectListItem>(); var userBooks = _bookAppUserService.GetByAppUserId(Convert.ToInt32((TempData["userId"]))); foreach (var userBook in userBooks) { result.Add(new SelectListItem(userBook.Title, userBook.Id.ToString())); } return(result); }
public async Task <IActionResult> Index(string user) { var books = _bookService.GetList(); var userId = 0; AppUser currentUser = new AppUser(); Models.Member member = new Models.Member(); CustomModel model = new CustomModel(); AppUser profileUser = new AppUser(); TempData["Active"] = "profile"; TempData["sa"] = TempData["deneme"]; var userprofile = TempData["currentUser"]; var appUser = await _userManager.FindByNameAsync(User.Identity.Name); if (userprofile == null) { profileUser = null; member.Id = appUser.Id; member.FirstName = appUser.FirstName; member.LastName = appUser.LastName; member.Email = appUser.Email; member.UserName = appUser.UserName; member.Description = appUser.Description; member.Picture = appUser.ProfileImageFile; model.Member = member; userId = appUser.Id; } else { profileUser = await _userManager.FindByNameAsync(userprofile.ToString()); member.Id = profileUser.Id; member.FirstName = profileUser.FirstName; member.LastName = profileUser.LastName; member.Email = profileUser.Email; member.UserName = profileUser.UserName; member.Description = profileUser.Description; member.Picture = profileUser.ProfileImageFile; model.Member = member; userId = profileUser.Id; } if (user == null) { currentUser = null; member.Id = appUser.Id; member.FirstName = appUser.FirstName; member.LastName = appUser.LastName; member.Email = appUser.Email; member.UserName = appUser.UserName; member.Description = appUser.Description; member.Picture = appUser.ProfileImageFile; model.Member = member; userId = appUser.Id; } else { currentUser = await _userManager.FindByNameAsync(user); member.Id = currentUser.Id; member.FirstName = currentUser.FirstName; member.LastName = currentUser.LastName; member.Email = currentUser.Email; member.UserName = currentUser.UserName; member.Description = currentUser.Description; member.Picture = currentUser.ProfileImageFile; model.Member = member; userId = currentUser.Id; } if (currentUser != null) { if (appUser.UserName != currentUser.UserName) { model.IsProfile = false; } else { model.IsProfile = true; } } if (profileUser != null) { if (appUser.UserName == profileUser.UserName) { model.IsProfile = true; } else { model.IsProfile = false; } } List <Review> reviews = new List <Review>(); List <Entities.Concrete.Quotation> quotations = new List <Entities.Concrete.Quotation>(); var userbooks = _bookAppUserService.GetByAppUserId(userId); foreach (var book in userbooks) { if (book.Reviews.Count > 0) { foreach (var reivew in book.Reviews) { if (reivew.AppUserId == userId) { reviews.Add(reivew); } } } if (book.Quotations.Count > 0) { foreach (var quotation in book.Quotations) { if (quotation.AppUserId == userId) { quotations.Add(quotation); } } } } quotations.ShuffleMethod(); reviews.ShuffleMethod(); ViewBag.Comment = reviews; ViewBag.Quotations = quotations; return(View(model)); }