Пример #1
0
        public ActionResult EditUser(string id)
        {
            // var rolelist = new List<SelectListItem>();
            var role = _roleservice.GetAllRole().Select(c => new SelectListItem
            {
                Text  = c.Name,
                Value = c.Id.ToString()
            }).ToList();

            //list sto
            ViewBag.RoleList = role;
            UserEntity data = _userservice.GetUserById(Convert.ToInt32(id));

            return(PartialView("_UserEdit", data));
        }
        public IActionResult GetAll()
        {
            IEnumerable <RoleMaster> role   = _roleService.GetAllRole();
            List <RoleViewModel>     roleVM = new List <RoleViewModel>();

            try
            {
                if (role != null)
                {
                    foreach (RoleMaster r in role)
                    {
                        MapperConfiguration config = new MapperConfiguration(cfg =>
                        {
                            cfg.CreateMap <RoleMaster, RoleViewModel>();
                        });
                        IMapper       mapper = config.CreateMapper();
                        RoleViewModel dest   = Mapper.Map <RoleMaster, RoleViewModel>(r);
                        roleVM.Add(dest);
                    }
                    throw new Exception("Exception while fetching all the students from the storage.");
                }
                //_logger.LogError($"Returning {role} roles.");



                return(Ok(roleVM));
            }
            catch (Exception ex)
            {
                throw new Exception("Exception while fetching all the students from the storage.", ex);
                //throw ex;
            }
        }
Пример #3
0
        public IHttpActionResult GetListAll([FromUri] InputGetAllRole input)
        {
            var result = _roleServices.GetAllRole(input);

            return(Ok(result));
        }
Пример #4
0
        public JsonResult YetkiGetir()
        {
            var data = _mapper.Map <List <RoleListDto> >(_appRoleService.GetAllRole());

            return(Json(JsonConvert.SerializeObject(data)));
        }