public HealthFacilityListModel GetHealthFacilitiesData(string HealthFacilityCode = "") { try { using (var db = new HMISDbContext()) { return(db.HealthFacilityDetails.Where(a => a.HFMISCode == HealthFacilityCode).Select(x => new HealthFacilityListModel { divisionCode = x.DivisionCode, DivisionName = x.DivisionName, districtCode = x.DistrictCode, DistrictName = x.DistrictName, tehsilCode = x.TehsilCode, TehsilName = x.TehsilName, HFMISCode = x.HFMISCode, HeathFacilityName = x.FullName, }).FirstOrDefault()); } } catch (Exception ex) { throw ex; } }
public List <DDLModel> GetOccupationList() { try { using (var db = new HMISDbContext()) { return(db.Occupations.Select(x => new DDLModel { Id = x.Id, Name = x.Name }).ToList()); } } catch (Exception ex) { throw ex; } }
public List <DDLModel> GetHealthfacilities(string tehsilCode = "", string HealthFacilityCode = "") { try { using (var db = new HMISDbContext()) { return(db.HealthFacilityDetails.Where(a => a.TehsilCode == (string.IsNullOrEmpty(tehsilCode) ? a.TehsilCode : tehsilCode) && a.Id.ToString() == (string.IsNullOrEmpty(HealthFacilityCode) ? a.Id.ToString() : HealthFacilityCode)).Select(x => new DDLModel { Code = x.HFMISCode, Name = x.FullName }).Distinct().ToList()); } } catch (Exception ex) { throw ex; } }
public List <DDLModel> GetDistrict(string divisionCode) { try { using (var db = new HMISDbContext()) { return(db.HealthFacilityDetails.Where(a => a.DivisionCode == divisionCode).OrderBy(x => x.DistrictName).Select(x => new DDLModel { Code = x.DistrictCode, Name = x.DistrictName }).Distinct().ToList()); } } catch (Exception ex) { throw ex; } }
public PaginationResult <AspNetUser> GetAllUsers(PaginationViewModel model) { try { using (var db = new HMISDbContext()) { IQueryable <AspNetUser> UserList; UserList = db.AspNetUsers.AsQueryable(); var TotalCount = UserList.Count(); UserList = UserList.OrderByDescending(x => x.Id);//.Skip((model.Page - 1) * (model.PageSize)).Take(model.PageSize); var res = UserList.ToList(); return(new PaginationResult <AspNetUser> { Data = res, RecordsTotal = TotalCount }); } } catch (Exception ex) { throw ex; } }