public async Task <ActionResult <List <Advertisement> > > Get([FromQuery] JobsParameter jobsParameter)
        {
            if (jobsParameter.advertisementTitle == null && jobsParameter.JobType == null && jobsParameter.Location == null)
            {
                var jobs = await _advertisementService.GetAdvertisemetsAsync();

                return(Ok(jobs));
            }
            else
            {
                AdvertisementContext _context = new AdvertisementContext();
                // var jobs = await _context.Advertisements.Where(c => c.JobType.ToLower() == jobsParameter.JobType.ToLower()
                //&& c.AdvertisementTitle.ToLower() == jobsParameter.JobTitle.ToLower() && c.Location == jobsParameter.Location).ToListAsync();
                var result = _context.Advertisements.AsQueryable();
                if (jobsParameter != null)
                {
                    if (!string.IsNullOrEmpty(jobsParameter.Location))
                    {
                        result = result.Where(x => x.Location.ToLower() == jobsParameter.Location.ToLower());
                    }
                    if (!string.IsNullOrEmpty(jobsParameter.JobType))
                    {
                        result = result.Where(x => x.JobType.ToLower() == jobsParameter.JobType.ToLower());
                    }
                    if (!string.IsNullOrEmpty(jobsParameter.advertisementTitle))
                    {
                        result = result.Where(x => x.AdvertisementTitle.ToLower().Contains(jobsParameter.advertisementTitle.ToLower()));
                    }
                }
                return(Ok(await result.ToListAsync()));
            }
        }
Beispiel #2
0
 public UserService(AdvertisementContext context, IConfiguration configuration
                    , IDividingService dividingService, IBannerService bannerService)
 {
     _configuration           = configuration;
     _context                 = context;
     _dividingDividingService = dividingService;
     _bannerService           = bannerService;
 }
 public AdvertisementRepository(AdvertisementContext context)
 {
     _context = context;
 }
 public DividingService(AdvertisementContext context)
 {
     _context = context;
 }
 public ProfileController(UserManager <User> userManager, SignInManager <User> signInManager, AdvertisementContext adb)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _adb           = adb;
 }
Beispiel #6
0
 public ShopController(AdvertisementContext adb, UserManager <User> userManager)
 {
     _adb         = adb;
     _userManager = userManager;
 }
Beispiel #7
0
 public ProfitAdvController(AdvertisementContext context)
 {
     _context = context;
 }
Beispiel #8
0
 public AboutMeServiceImpl(UserContext consumerContext, AdvertisementContext advertisementContext)
 {
     _consumerContext      = consumerContext;
     _advertisementContext = advertisementContext;
 }
 public UserController(AdvertisementContext context)
 {
     _context = context;
 }
 public AdvMarkController(AdvertisementContext context)
 {
     _context = context;
 }
Beispiel #11
0
 public AdvertisementService(AdvertisementContext context) : base(context)
 {
 }
 public AccountController(AdvertisementContext context)
 {
     _context = context;
 }