Exemplo n.º 1
0
        public async Task <IActionResult> Profile()
        {
            var user = await _userManager.GetUserAsync(User);

            var ilanlar = _ilanService.GetIlanlar("").Where(i => i.userId == Convert.ToString(user.Id)).ToList();
            var favs    = _favService.GetFavByUserId(_userManager.GetUserId(User));

            ViewBag.favs       = favs.Count();
            ViewBag.ilansayisi = ilanlar.Count();
            var model = new UserProfileModel()
            {
                UserName       = user.UserName,
                FirstName      = user.FirstName,
                LastName       = user.LastName,
                Address        = user.Address,
                PhoneNumber    = user.PhoneNumber,
                Email          = user.Email,
                MembershipDate = user.MembershipDate.ToString().TrimEnd('0', ':'),
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Details(int?id)
        {
            var ilan = _ilanService.GetIlanDetail((int)id);
            var user = await _userManager.FindByIdAsync(ilan.userId);

            var favoriilanlar = _favService.GetFavByUserId(_userManager.GetUserId(User));

            if (id == null)
            {
                return(NotFound());
            }
            var model = new IlanDetailViewModel()
            {
                ilan              = ilan,
                user              = user,
                ilanResimleri     = ilan.IlanResimleri,
                ilanFavorilerdemi = favoriilanlar.Any(i => i.IlanId == id)
            };

            return(View(model));
        }