using CZFW.Framework.Interface;
using CZKJ.GBRS2.Interface;
using CZKJ.GBRS2.WebMVC.Models;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace CZKJ.GBRS2.WebMVC.Controllers
{
///
/// 招聘信息
///
public class PositionController : Controller
{
IGallery _galleryLogic;
IPosition _positionLogic;
IDictItem _dictItemLogic;
public PositionController(IGallery galleryLogic, IPosition positionLogic, IDictItem dictItemLogic)
{
_galleryLogic = galleryLogic;
_positionLogic = positionLogic;
_dictItemLogic = dictItemLogic;
}
public IActionResult Index()
{
var model = new RecuritModel();
var idList = new List { 129, 130, 126, 127 };
var galleryList = _galleryLogic.GetEntities(x => idList.Contains(x.TypeId), x => x.SortOrder, ListSortDirection.Descending);
model.GalleryEntity = galleryList.FirstOrDefault(x => x.TypeId == 129);
model.GalleryList = galleryList.Where(x => x.TypeId == 130).ToList();
model.SalaryGalist = galleryList.Where(x => x.TypeId == 126).ToList();
model.EnvironmentalList = galleryList.Where(x => x.TypeId == 127).ToList();
return View(model);
}
///
/// 招聘详情
///
///
public IActionResult Detail(int id)
{
var entity = _positionLogic.GetItem(id);
ViewBag.RelevantList = _positionLogic.GetPositionList(id,entity.TypeId,entity.DepartmentId);
return View(entity);
}
///
/// 社会招聘
///
///
public IActionResult List(int? deptId, int? addressId, int typeId = 74, int pageIndex = 1, int pageSize = 10)
{
var model = new RecuritListModel();
int rowsCount;
model.DeptId = deptId;
model.AddressId = addressId;
model.TypeId = typeId;
model.GalleryEntity = _galleryLogic.GetEntity(x => x.TypeId == (typeId == 74 ? 133 : 134));
model.PositionList = _positionLogic.GetPositionList("", typeId, addressId, deptId, pageIndex, pageSize, out rowsCount);
model.DeptList = _dictItemLogic.GetEntities(x => x.DictMark == "DepartmentMark");
model.AddressList = _dictItemLogic.GetEntities(x => x.DictMark == "AddressMark");
model.RowsCount = rowsCount;
model.PageIndex = pageIndex;
return View(model);
}
}
}