public async Task <ActionResult <CheckingStatus_CheckingStatusDTO> > Create([FromBody] CheckingStatus_CheckingStatusDTO CheckingStatus_CheckingStatusDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(CheckingStatus_CheckingStatusDTO.Id)) { return(Forbid()); } CheckingStatus CheckingStatus = ConvertDTOToEntity(CheckingStatus_CheckingStatusDTO); CheckingStatus = await CheckingStatusService.Create(CheckingStatus); CheckingStatus_CheckingStatusDTO = new CheckingStatus_CheckingStatusDTO(CheckingStatus); if (CheckingStatus.IsValidated) { return(CheckingStatus_CheckingStatusDTO); } else { return(BadRequest(CheckingStatus_CheckingStatusDTO)); } }
private CheckingStatus ConvertDTOToEntity(CheckingStatus_CheckingStatusDTO CheckingStatus_CheckingStatusDTO) { CheckingStatus CheckingStatus = new CheckingStatus(); CheckingStatus.Id = CheckingStatus_CheckingStatusDTO.Id; CheckingStatus.Code = CheckingStatus_CheckingStatusDTO.Code; CheckingStatus.Name = CheckingStatus_CheckingStatusDTO.Name; CheckingStatus.BaseLanguage = CurrentContext.Language; return(CheckingStatus); }
public async Task <ActionResult <CheckingStatus_CheckingStatusDTO> > Get([FromBody] CheckingStatus_CheckingStatusDTO CheckingStatus_CheckingStatusDTO) { if (!ModelState.IsValid) { throw new BindException(ModelState); } if (!await HasPermission(CheckingStatus_CheckingStatusDTO.Id)) { return(Forbid()); } CheckingStatus CheckingStatus = await CheckingStatusService.Get(CheckingStatus_CheckingStatusDTO.Id); return(new CheckingStatus_CheckingStatusDTO(CheckingStatus)); }