public IEnumerable<News> All(int pageIndex, int pageSize, out long totalRows) { using (var db = new MainDb()) { var query = Query<News>.EQ(x=>x.Status,(int)GlobalStatus.Actived); var sort = SortBy<News>.Descending(x=>x.Created); return db.Find<News>(query, sort, pageIndex, pageSize, out totalRows); } }
// public List <BusinessServiceLookupVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.businessServiceLookups .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
public UserService ( MainDb db, IUserRepository userRepository, PasswordHashService passwordHashService ) { _db = db; _userRepository = userRepository; _passwordHashService = passwordHashService; }
private IQueryable <AnalyseTypeModel> MakeSelect(MainDb db) { var query = from analysetype in db.AnalyseType select new AnalyseTypeModel { Id = analysetype.Id, Name = analysetype.Name }; return(query); }
public ActionResult RemoveFromCart(int id) { OrderDetail od = MainDb.OrderDetails.Where(x => x.ProductID == id).FirstOrDefault(); MainDb.OrderDetails.Remove(od); MainDb.SaveChanges(); TempData["OrderDetail"] = MainDb.OrderDetails.ToList(); TempData["message"] = "Ürün sepetinizden silindi!"; return(RedirectToAction("Cart")); }
public ActionResult RemoveFromWishlist(int id) { Wishlist wish = MainDb.Wishlists.Where(x => x.ProductID == id).FirstOrDefault(); MainDb.Wishlists.Remove(wish); MainDb.SaveChanges(); TempData["Wishlist"] = MainDb.Wishlists.ToList(); TempData["message"] = "Ürün izleme listenizden silindi!"; return(RedirectToAction("Wishlist")); }
/// <summary> /// Find Member matching the memberId (primary key) /// </summary> public MemberVo get(int memberId) { using (var db = new MainDb()) { var res = db.members .Include(a => a.memberRoleLookupses.Select(c => c.memberRoleType)) .FirstOrDefault(p => p.memberId == memberId); return(res); } }
// public List <MemberVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.members .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
// public List <ContactInfoVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.contactInfos .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
// public List <OptionTypeVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.optionTypes .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
public IEnumerable <News> All(int pageIndex, int pageSize, out long totalRows) { using (var db = new MainDb()) { var query = Query <News> .EQ(x => x.Status, (int)GlobalStatus.Actived); var sort = SortBy <News> .Descending(x => x.Created); return(db.Find <News>(query, sort, pageIndex, pageSize, out totalRows)); } }
private IQueryable <JobModel> MakeSelect(MainDb db) { var query = from job in db.Job select new JobModel { Id = job.Id, Name = job.Name, }; return(query); }
// public List <CompanyCategoryTypeVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.companyCategoryTypes .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
/// <summary> /// Get First Item /// </summary> public ReferralVo getFirst() { using (var db = new MainDb()) { var res = db.referrals .Include(a => a.surveyAnswerses) .FirstOrDefault(); return(res); } }
public bool delete(int clientId) { using (var db = new MainDb()) { var res = db.clients .Include(i => i.contactInfo) .Include(o => o.clientOrganizationLookupses) .Where(e => e.clientId == clientId) .Delete(); return(true); } }
/// <summary> /// Get First Item /// </summary> public MemberVo getFirst() { using (var db = new MainDb()) { var res = db.members .Include(i => i.contactInfo) .Include(a => a.memberRoleLookupses) .FirstOrDefault(); return(res); } }
// public List <SurveyAnswerVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.surveyAnswers .Include(a => a.questionType) .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
public List <OrganizationVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.organizations .Include(i => i.contactInfo) .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
public SearchFilterVm searchForOrgOverviewMembers(int orgID, SearchFilterVm input) { int keywordInt = 0; int.TryParse(input.keyword, out keywordInt); if (keywordInt < 0) { keywordInt = 0; } List <int> clientsOrgLookupIDs; ContactInfoVo contact; List <ContactInfoVo> query = new List <ContactInfoVo>(); using (var db = new MainDb()) { clientsOrgLookupIDs = db.clientOrganizationLookups .Where(e => (e.organizationId == orgID)) .Select(e => e.clientId) .ToList(); if (clientsOrgLookupIDs.Count() > 0) { foreach (int i in clientsOrgLookupIDs) { contact = db.clients .Where(c => (c.clientId == i)) .Select(c => c.contactInfo).FirstOrDefault(); query.Add(contact); } } if (query.Count() > 0) { foreach (ContactInfoVo con in query) { con.feeAmount = db.clients .Where(c => (c.contactInfoId == con.contactInfoId)) .Select(c => c.feeAmount).FirstOrDefault(); } } } var query1 = query.AsQueryable(); if (input.paging != null) { input.paging.totalCount = query1.Count(); query1 = query1 .Skip(input.paging.skip) .Take(input.paging.rowCount); } input.result = query1.ToList <object>(); return(input); }
private IQueryable <ProcTypeModel> MakeSelect(MainDb db) { var query = from proctype in db.ProcType select new ProcTypeModel { Id = proctype.Id, Name = proctype.Name, Job_Id = proctype.Job_Id }; return(query); }
public MemberVo getByUsername(string usernameOrEmail) { using (var db = new MainDb()) { var mem = db.members .Include(i => i.contactInfo) .Include(a => a.memberRoleLookupses.Select(c => c.memberRoleType)) .FirstOrDefault(p => p.username == usernameOrEmail); return(mem); } }
/// <summary> /// Find Client matching the contactMembershipId (primary key) /// </summary> public ClientVo get(int clientId) { using (var db = new MainDb()) { var res = db.clients .Include(i => i.contactInfo) .Include(a => a.clientOrganizationLookupses.Select(c => c.organization)) .FirstOrDefault(p => p.clientId == clientId); return(res); } }
public IEnumerable <ClientVo> getAllClients() { using (var db = new MainDb()) { var list = db.clients .Include(i => i.contactInfo) .Include(o => o.clientOrganizationLookupses) .OrderBy(i => i.contactInfo.firstName).ToList(); return(list); } }
public static int getOrgIDForClient(int clientID) { int orgID; using (var db = new MainDb()) { orgID = db.clientOrganizationLookups .Where(e => (e.clientId == clientID)) .Select(e => e.organizationId).FirstOrDefault(); } return(orgID); }
// public List <ReferralVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.referrals .Include(a => a.surveyAnswerses) .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
/// <summary> /// Find Referral matching the referralId (primary key) /// </summary> public ReferralVo get(int referralId) { using (var db = new MainDb()) { var res = db.referrals .Include(a => a.surveyAnswerses) .Include(q => q.surveyAnswerses.Select(c => c.questionType)) .FirstOrDefault(p => p.referralId == referralId); return(res); } }
/// <summary> /// Get First Item /// </summary> public ClientVo getFirst() { using (var db = new MainDb()) { var res = db.clients .Include(i => i.contactInfo) .Include(o => o.clientOrganizationLookupses) .FirstOrDefault(); return(res); } }
private IQueryable <DateModel> MakeSelect(MainDb db) { var query = from date in db.Date select new DateModel { Id = date.Id, Day = date.Day, Time = date.Time }; return(query); }
// public List <MemberRoleLookupVo> getAll(bool?isActive = true) { using (var db = new MainDb()) { var list = db.memberRoleLookups .Include(r => r.memberRoleType) .Where(e => isActive == null || e.isActive == isActive) .ToList(); return(list); } }
public static string getOrgNameByID(int orgID) { string orgName = ""; using (var db = new MainDb()) { orgName = db.organizations .Where(e => (e.organizationId == orgID)) .Select(e => e.name).FirstOrDefault(); } return(orgName); }
/// <summary> /// Get First Item /// </summary> public CompanyVo getFirst() { using (var db = new MainDb()) { var res = db.companies .Include(i => i.contactInfo) .Include(c => c.companyCategoryLookupses) .FirstOrDefault(); return(res); } }
public IEnumerable<News> QuickSearch(ObjectId catid, string kwd, int pageIndex, int pageSize, out long totalRows) { using (var db = new MainDb()) { var _query = Query.Or( Query.Matches("title", BsonRegularExpression.Create(new Regex(kwd, RegexOptions.IgnoreCase))), Query.Matches("html", BsonRegularExpression.Create(new Regex(kwd, RegexOptions.IgnoreCase))), Query.In("tags", new BsonArray(kwd)) ); return db.Find<News>(_query, SortBy.Descending("crt"), pageIndex, pageSize, out totalRows); } }