public async Task <ActionResult <CustomerResource_CustomerResourceDTO> > Create([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.Create(CustomerResource); CustomerResource_CustomerResourceDTO = new CustomerResource_CustomerResourceDTO(CustomerResource); if (CustomerResource.IsValidated) { return(CustomerResource_CustomerResourceDTO); } else { return(BadRequest(CustomerResource_CustomerResourceDTO)); } }
public IActionResult Create() { var resource = ResourceService.Create(); return(Json(resource)); }