public IHttpActionResult UserProfile(long id, string data) { try { UserRepository userRepo = new UserRepository(); Applicant app = userRepo.GetApplicant(id); JobRepository jobRepo = new JobRepository(); UserCollectionsViewModel model = new UserCollectionsViewModel(); switch (data) { case "educ": model.educ = userRepo.GetListEducationalInfo(id); break; case "basic": model.basicInfo = userRepo.GetBasicInfo(id); break; case "saved": model.savedJobs = jobRepo.GetSavedJobs(id); break; case "exp": model.exp = userRepo.GetExperience(userRepo.GetApplicant(id).resume_id); break; default: model.initialInfo = userRepo.GetInitialInfo(id); break; } SelectRepository selectRepo = new SelectRepository(); model.jobSearch = new JobFilterCollectionViewModel(); model.jobSearch.workbases = selectRepo.Workbases(); model.jobSearch.specializations = selectRepo.Specializations(); ContentRepository contentRepo = new ContentRepository(); model.news = contentRepo.GetLatest("news", 2); model.partners = contentRepo.GetLatest("partners", 6); SettingsRepository settingsRepo = new SettingsRepository(); model.fb = JsonConvert.DeserializeObject<FacebookViewModel>(settingsRepo.GetSetting("fb").value); model.hotJobs = jobRepo.GetHotJobs(); model.recommendedJobs = jobRepo.GetRecommendedJobs(app); model.savedJobsCount = jobRepo.GetSavedJobs(app.id).Count; JobGroupRepository groupRepo = new JobGroupRepository(); List<JobGroupViewModel> groups = groupRepo.GetList(string.Empty, "sequence_asc", true); foreach (var g in groups) { g.jobs = jobRepo.GetByGroup(g.id); model.jobGroups.Add(g); } model.promotions = userRepo.GetPromotions(app.resume_id); model.initialInfo = userRepo.GetInitialInfo(id); model.photo = app.photo; model.interview = userRepo.GetInterviewStatus(app.role_id); return Ok(model); } catch (Exception ex) { return BadRequest(ex.Message); } }