public async Task <IActionResult> Create([FromBody] SheetDto sheet) { var isAllowedToCreate = await _contractManager.CheckContractIsActive(sheet.ContractId); if (isAllowedToCreate != null && !(bool)isAllowedToCreate) { return(BadRequest($"Contract {sheet.ContractId} is not active or not found.")); } var id = await _sheetManager.Create(_mapper.Map <Sheet>(sheet)); return(Ok(id)); }
public async Task <IActionResult> Create([FromBody] InvoiceDto invoice) { var isAllowedToCreate = await _contractManager.CheckContractIsActive(invoice.ContractId); if (isAllowedToCreate != null && !(bool)isAllowedToCreate) { return(BadRequest($"Contract {invoice.ContractId} is not active or not found.")); } var id = await _invoiceManager.Greate(_mapper.Map <Invoice>(invoice)); return(Ok(id)); }