/// <summary>
        /// 编辑
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public ActionResult Edit(QueryDetailSystemStaffRequestModel requestModel)
        {
            var staffRoleList = _systemStaffRoleService.QueryStaffRoleByStaffId(requestModel.Id);
            var roleList      = _systemRoleService.GetSystemRole();
            IEnumerable <SelectListItem> Roles = roleList.Select(x => new SelectListItem
            {
                Value    = x.Id.ToString(),
                Text     = x.RoleName,
                Selected = staffRoleList.Where(y => y.RoleId == x.Id).Count() > 0,
            });

            ViewBag.Roles = Roles;

            var sectionList = _systemSectionService.GetSystemSection();
            IEnumerable <SelectListItem> Sections = sectionList.Select(x => new SelectListItem
            {
                Value    = x.Id.ToString(),
                Text     = x.Name,
                Selected = false,
            });

            ViewBag.Sections = Sections;

            var res = _systemStaffService.QueryDetail(requestModel);

            return(View(res.BusinessData));
        }
Esempio n. 2
0
        /// <summary>
        /// 详情查询
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public BusinessBaseViewModel <QueryDetailSystemStaffResponseModel> QueryDetail(QueryDetailSystemStaffRequestModel requestModel)
        {
            var res = new BusinessBaseViewModel <QueryDetailSystemStaffResponseModel>()
            {
                Status = ResponseStatus.Fail
            };

            if (requestModel.Id <= 0)
            {
                res.ErrorMessage = "Id不能为空";
                res.Status       = ResponseStatus.ParameterError;
                return(res);
            }

            var query = _staffRepostory.Find(x => x.Id == requestModel.Id);

            if (query.Any())
            {
                var entity = query.FirstOrDefault();
                res.BusinessData = entity.MapTo <QueryDetailSystemStaffResponseModel>();
            }

            res.Status = ResponseStatus.Success;
            return(res);
        }