示例#1
0
        public IActionResult GetAllUserAuthority()
        {
            var authority = _service.GetAllUserAuthority();
            List <UserAuthorityDto> Dto = new List <UserAuthorityDto>();

            foreach (var item in authority)
            {
                UserAuthorityDto Dtos = _mapper.Map <UserAuthorityDto>(item);
                Dto.Add(Dtos);
            }
            return(Ok(Dto));
        }
示例#2
0
        public IActionResult DeleteUserAuthority(int id, [FromBody] UserAuthorityDto UserAuthority)
        {
            var authority = _mapper.Map <UserAuthority>(UserAuthority);

            try
            {
                _service.Delete(id);
                return(Ok("Record Deleted Successfully.."));
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
示例#3
0
        public IActionResult UpdateUserAuthority(int id, [FromBody] UserAuthorityDto UserAuthority)
        {
            var authority = _mapper.Map <UserAuthority>(UserAuthority);

            try
            {
                _service.Update(authority, id);
                return(Ok());
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
示例#4
0
        public IActionResult AddUserAuthority([FromBody] UserAuthorityDto userAuthority)
        {
            var authority = _mapper.Map <UserAuthority>(userAuthority);

            try
            {
                _service.Create(authority);
                return(Ok("Records Added Successfully.. "));
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
示例#5
0
        ///TODO- need to add this profile fields in db and api
        public IActionResult GetUserAuthorityByID(int id)
        {
            var authority = _service.GetById(id);

            if (authority == null)
            {
                return(new UnauthorizedResult());
            }
            UserAuthorityDto authDto = new UserAuthorityDto()
            {
                ID = authority.ID, Authority = authority.Authority, JGCITCode = authority.JGCITCode
            };

            return(Ok(authDto));
        }