コード例 #1
0
        public async Task <ActionResult <CustomerResource_CustomerResourceDTO> > Delete([FromBody] CustomerResource_CustomerResourceDTO CustomerResource_CustomerResourceDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            if (!await HasPermission(CustomerResource_CustomerResourceDTO.Id))
            {
                return(Forbid());
            }

            CustomerResource CustomerResource = ConvertDTOToEntity(CustomerResource_CustomerResourceDTO);

            CustomerResource = await CustomerResourceService.Delete(CustomerResource);

            CustomerResource_CustomerResourceDTO = new CustomerResource_CustomerResourceDTO(CustomerResource);
            if (CustomerResource.IsValidated)
            {
                return(CustomerResource_CustomerResourceDTO);
            }
            else
            {
                return(BadRequest(CustomerResource_CustomerResourceDTO));
            }
        }
コード例 #2
0
        public async Task <IActionResult> DeleteCustomerResource(string id)
        {
            var result = await _customerResourceService.Delete(CurrentUser.TenantId, id);

            //   var result = await _patientResourceService.Delete("1", id);
            if (result.Code <= 0)
            {
                return(BadRequest(result));
            }
            return(Ok(result));
        }