public ActionResult Index() { ContactDetailModel contactDetail = new ContactDetailModel(); IList <Profile> allProfile = new List <Profile>(); if (HttpRuntime.Cache["profile"] != null) { allProfile = HttpRuntime.Cache["profile"] as List <Profile>; } else { allProfile = _profileService.GetAll().ToList(); SqlCacheHelper.FetchFromDb("profile", allProfile); } if (allProfile.Count > 0) { contactDetail = allProfile.Select(p => new ContactDetailModel { Phone = p.Phone, Email = p.Email, Street = p.Street, Suburb = p.Suburb, State = p.State, Country = p.Country }).First(); } return(View(contactDetail)); }
private List <ProjectModel> GetAllProject() { List <ProjectModel> projectList = new List <ProjectModel>(); IList <Project> projects = new List <Project>(); if (HttpRuntime.Cache["Project"] != null) { projects = HttpRuntime.Cache["Project"] as List <Project>; } else { projects = _projectService.GetAllWithSubTables().ToList(); SqlCacheHelper.FetchFromDb("Project", projects); } foreach (var aProject in projects) { ProjectModel projectModel = new ProjectModel(); projectModel.Name = aProject.Name; projectModel.Purpose = aProject.Purpose; projectModel.Language = aProject.Language; projectModel.DevelopmentTool = aProject.DevelopmentTool; ProjectType projectTypeVal = (ProjectType)Enum.Parse(typeof(ProjectType), aProject.ProjectTypeID.ToString()); projectModel.TypeName = EnumExtensions.GetDisplayName(projectTypeVal); foreach (var aprojectDuty in aProject.ProjectDuties) { ProjectDutyModel projectDutyModel = new ProjectDutyModel(); projectDutyModel.ListItem = aprojectDuty.ListItem; projectModel.ProjectDutyList.Add(projectDutyModel); } foreach (var aprojectTech in aProject.ProjectTechniques) { ProjectTechModel projectTechModel = new ProjectTechModel(); projectTechModel.ListItem = aprojectTech.ListItem; projectModel.ProjectTechList.Add(projectTechModel); } projectList.Add(projectModel); } return(projectList); }
public HttpResponseMessage GetSkillSummary() { IList <SkillSummary> skillSummaryList = new List <SkillSummary>(); if (HttpRuntime.Cache["SkillSummary"] != null) { skillSummaryList = HttpRuntime.Cache["SkillSummary"] as List <SkillSummary>; } else { skillSummaryList = _skillSummaryService.GetAll().ToList(); SqlCacheHelper.FetchFromDb("SkillSummary", skillSummaryList); } if (skillSummaryList.Count == 0) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, skillSummaryList)); }
public HttpResponseMessage GetReferees() { IList <Referee> refereeList = new List <Referee>(); if (HttpRuntime.Cache["Referee"] != null) { refereeList = HttpRuntime.Cache["Referee"] as List <Referee>; } else { refereeList = _refereeService.GetAll().ToList(); SqlCacheHelper.FetchFromDb("Referee", refereeList); } if (refereeList.Count == 0) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, refereeList)); }
public HttpResponseMessage GetProfile() { IList <Profile> allProfile = new List <Profile>(); if (HttpRuntime.Cache["Profile"] != null) { allProfile = HttpRuntime.Cache["Profile"] as List <Profile>; } else { allProfile = _profileService.GetAll().ToList(); SqlCacheHelper.FetchFromDb("Profile", allProfile); } if (allProfile.FirstOrDefault() == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, allProfile.FirstOrDefault())); }
public HttpResponseMessage GetEduBackground() { IList <Education> educationList = new List <Education>(); if (HttpRuntime.Cache["Education"] != null) { educationList = HttpRuntime.Cache["Education"] as List <Education>; } else { educationList = _educationService.GetAll().ToList(); SqlCacheHelper.FetchFromDb("Education", educationList); } if (educationList.Count == 0) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, educationList)); }
public HttpResponseMessage GetWorkExperiences() { List <WorkExpModel> workExpList = new List <WorkExpModel>(); IList <WorkExp> workExps = new List <WorkExp>(); if (HttpRuntime.Cache["WorkExp"] != null) { workExps = HttpRuntime.Cache["WorkExp"] as List <WorkExp>; } else { workExps = _workExpService.GetAllWithSubTables().ToList(); SqlCacheHelper.FetchFromDb("WorkExp", workExps); } foreach (var aworkExp in workExps) { WorkExpModel workExpModel = new WorkExpModel(); workExpModel.StartDate = aworkExp.StartDate; workExpModel.EndDate = aworkExp.EndDate; workExpModel.CorpName = aworkExp.CorpName; workExpModel.Location = aworkExp.Location; workExpModel.Position = aworkExp.Position; foreach (var apositionDuty in aworkExp.PositionDuties) { PositionDutyModel positionDutyModel = new PositionDutyModel(); positionDutyModel.ListItem = apositionDuty.ListItem; workExpModel.positionDutyList.Add(positionDutyModel); } workExpList.Add(workExpModel); } if (workExpList.Count == 0) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK, workExpList)); }