/// <summary> /// JobCategory Edit /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Edit(int?id) { if (!id.HasValue) { return(RedirectToAction("List")); } var jobCategory = jobCategoryService.GetById(id.Value); if (jobCategory == null) { this.NotifyError("Item not found."); return(RedirectToAction("List")); } var model = new JobCategoryModel { Id = jobCategory.Id, Name = jobCategory.Name, IsActive = jobCategory.IsActive, JobCount = jobService.GetCount(jobCategory.Id) }; return(View(model)); }
public ActionResult List() { var jobs = jobService.GetJobs().Select(x => new JobModel { Id = x.Id, Title = x.Title, CreateDate = x.CreateDateUtc, Url = urlService.GetUrl(x.Id, nameof(Job)), CategoryName = jobCategoryService.GetById(x.CategoryId).Name, ViewCount = x.ViewCount, IsActive = x.IsActive }).ToList(); return(View(new GridModel <JobModel> { Data = jobs, Total = jobs.Count() })); }
private void PrepareJob(Job job) { if (job == null) { return; } job.Url = cacheManager.Get(CacheConstant.JOB_URL_ITEM.FormatInvariant(job.Id), () => { return(urlService.GetUrl(job.Id, nameof(Job))); }); job.Category = cacheManager.Get(CacheConstant.JOB_CATEGORY_ITEM.FormatInvariant(job.CategoryId), () => { return(categoryService.GetById(job.CategoryId)); }); job.ApplyJobs = cacheManager.Get(CacheConstant.JOB_ITEM_APPLY_JOBS.FormatInvariant(job.Id), () => { return(applyJobService.GetApplyJobsByJobId(job.Id).ToList()); }); }