示例#1
0
        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));
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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));
        }