public async Task <IActionResult> GetActiveAdsByUserId(string id) { if (String.IsNullOrEmpty(id)) { return(RedirectToAction("Index")); } var operationDetails = await _adService.GetActiveAdsByUserId(id); if (!operationDetails.Succedeed) { return(RedirectToAction("Index")); } UserAdsViewModel model = new UserAdsViewModel { Ads = operationDetails.Property.ToList(), User = new UserDTO { Id = operationDetails.Property.FirstOrDefault().ApplicationUser.Id, Email = operationDetails.Property.FirstOrDefault().ApplicationUser.Email, UserName = operationDetails.Property.FirstOrDefault().ApplicationUser.UserName, PhoneNumber = operationDetails.Property.FirstOrDefault().ApplicationUser.PhoneNumber, RegistrationDate = operationDetails.Property.FirstOrDefault().ApplicationUser.RegistrationDate } }; return(View("UserActiveAds", model)); }