public int GetTotalAdApplications(string userId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdApplicantId == userId select e).Count()); } }
public AdApplication FindbyHireModel(string userName, int adId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdApplicantId == userName && e.AdId == adId select e).FirstOrDefault()); } }
public Ad[] GetPersonalAds(string userId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AccountId == userId select e).ToArray()); } }
public AdApplication GetSuccesfulAdApplication(int adId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdId == adId && e.Status == ApplicationStatus.Accepted select e).FirstOrDefault()); } }
public int GetTotalAds() { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AdClosed == false select e).Count()); } }
public int GetTotalUserReviews(string userId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.ReviewSet where e.ReviewFor == userId select e).Count()); } }
public List <string> GetAdApplicant(int adId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdId == adId select e.AdApplicantId).ToList()); } }
public AdApplication[] GetAdApplicationsById(int adId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdId == adId && e.Status == ApplicationStatus.Open select e).ToArray()); } }
public Ad[] GetApplyAds(string userId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AccountId != userId where e.AdClosed == false select e).ToArray()); } }
public Ad[] GetTopAds() { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AdClosed == false orderby e.DateCreated descending select e).Take(12).ToArray()); } }
public Ad[] GetAdByCategory(int categoryId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from a in entityContext.AdSet where a.AdClosed == false where a.CategoryId == categoryId select a).ToArray()); } }
public Ad[] GetByLocation(string userId) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AccountId != userId where e.AdClosed == false orderby e.DateCreated descending select e).Take(7).ToArray <Ad>()); } }
public int GetTotalUserAds(string userId, bool forUser) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { if (!forUser) { return((from e in entityContext.AdSet where e.AccountId != userId select e).Count()); } return((from e in entityContext.AdSet where e.AccountId == userId select e).Count()); } }
public Review[] GetUserReviews(string userId, int pageNumber) { if (pageNumber == 0) { pageNumber = 1; } int pageSize = 10; int skip = (pageNumber * pageSize) - pageSize; using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.ReviewSet where e.ReviewFor == userId orderby e.DateCreated descending select e).Skip(skip).Take(pageSize).ToArray()); } }
public Ad[] GetAllAdsPaged(int pageId) { if (pageId == 0) { pageId = 1; } int pageSize = 12; int skip = (pageId * pageSize) - pageSize; using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdSet where e.AdClosed == false orderby e.DateCreated descending select e).Skip(skip).Take(pageSize).ToArray()); } }
public List <AdApplication> FindUserAdApplications(string userId, int pageNumber) { if (pageNumber == 0) { pageNumber = 1; } int pageSize = 10; int skip = (pageNumber * pageSize) - pageSize; using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { return((from e in entityContext.AdApplicationSet where e.AdApplicantId == userId orderby e.DateApplied descending select e).ToList()); } }
public Ad[] GetPageAds(string userId, int pageNumber, bool userOwned) { if (pageNumber == 0) { pageNumber = 1; } int pageSize = 10; int skip = (pageNumber * pageSize) - pageSize; using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { if (!userOwned) { Ad[] ads = (from e in entityContext.AdSet where e.AccountId != userId orderby e.DateCreated descending select e).Skip(skip).Take(pageSize).ToArray(); foreach (var ad in ads) { AdApplication adApplication = (from e in entityContext.AdApplicationSet where e.AdId == ad.AdId && e.AdApplicantId == userId select e).FirstOrDefault(); if (adApplication != null) { ad.AdApplied = true; } } return(ads); } else { return((from e in entityContext.AdSet where e.AccountId == userId orderby e.DateCreated descending select e).Skip(skip).Take(pageSize).ToArray()); } } }
public Ad[] GetBySearchTerms(SearchModel searchModel) { using (JobMtaaniDbContext entityContext = new JobMtaaniDbContext()) { if (searchModel.JobLocation != null) { return((from e in entityContext.AdSet where e.AdClosed == false where (e.AdTitle.Contains(searchModel.SearchTerm) || e.AdDescription.Contains(searchModel.SearchTerm)) && e.AdLocation == searchModel.JobLocation select e).ToArray()); } else { return((from e in entityContext.AdSet where e.AdClosed == false where (e.AdTitle.Contains(searchModel.SearchTerm) || e.AdDescription.Contains(searchModel.SearchTerm)) select e).ToArray()); } } }
protected override IEnumerable <Category> GetEntities(JobMtaaniDbContext entityContext) { return(from e in entityContext.CategorySet select e); }
protected override Category AddEntity(JobMtaaniDbContext entityContext, Category entity) { return(entityContext.CategorySet.Add(entity)); }
protected override Payment UpdateEntity(JobMtaaniDbContext entityContext, Payment entity) { return((from e in entityContext.PaymentSet where e.PaymentId == entity.PaymentId select e).FirstOrDefault()); }
protected override Payment GetEntity(JobMtaaniDbContext entityContext, int id) { return((from e in entityContext.PaymentSet where e.PaymentId == id select e).FirstOrDefault()); }
protected override IEnumerable <Payment> GetEntities(JobMtaaniDbContext entityContext) { return(from e in entityContext.PaymentSet select e); }
protected override Payment AddEntity(JobMtaaniDbContext entityContext, Payment entity) { return(entityContext.PaymentSet.Add(entity)); }
protected override Subscription GetEntity(JobMtaaniDbContext entityContext, int id) { return((from e in entityContext.SubscriptionSet where e.SubscriptionId == id select e).FirstOrDefault()); }
protected override IEnumerable <Subscription> GetEntities(JobMtaaniDbContext entityContext) { return(from e in entityContext.SubscriptionSet select e); }
protected override Subscription AddEntity(JobMtaaniDbContext entityContext, Subscription entity) { return(entityContext.SubscriptionSet.Add(entity)); }
protected override Category GetEntity(JobMtaaniDbContext entityContext, int id) { return((from e in entityContext.CategorySet where e.CategoryId == id select e).FirstOrDefault()); }
protected override Category UpdateEntity(JobMtaaniDbContext entityContext, Category entity) { return((from e in entityContext.CategorySet where e.CategoryId == entity.CategoryId select e).FirstOrDefault()); }
protected override Subscription UpdateEntity(JobMtaaniDbContext entityContext, Subscription entity) { return((from e in entityContext.SubscriptionSet where e.SubscriptionId == entity.SubscriptionId select e).FirstOrDefault()); }