public async Task <PiResult> Create(CreatePiDto createPiDto) { var isExist = piRepository.IsPiExistByCode(createPiDto.PiCode.Trim().ToLower()); if (isExist) { return(PiResult.ProformaInvoiceIsExist); } var pi = new PeroformaInvoice() { BasePrice = createPiDto.BasePrice, PiCode = createPiDto.PiCode.SanitizeText(), Description = createPiDto.Description.SanitizeText(), PiDate = createPiDto.PiDate, TotalPrice = createPiDto.TotalPrice, IsSold = false, CommodityCustomerId = createPiDto.CustomerId }; await piRepository.AddEntity(pi); await piRepository.SaveChanges(); return(PiResult.Success); }