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)); }
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 })); } }
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 })); } }
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 })); } }
///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)); }