public async Task <ActionResult> PostAsync(SalesReceipt model) { if (!this.ModelState.IsValid) { return(this.InvalidModelState(this.ModelState)); } if (model.CashRepositoryId == 0 && model.BankAccountId == 0) { this.Failed(I18N.InvalidReceiptMode, HttpStatusCode.InternalServerError); } if (model.CashRepositoryId > 0 && (model.BankAccountId > 0 || !string.IsNullOrWhiteSpace(model.BankInstrumentCode) || !string.IsNullOrWhiteSpace(model.BankInstrumentCode))) { this.Failed(I18N.CashTransactionCannotContainBankTransactionDetails, HttpStatusCode.InternalServerError); } var meta = await AppUsers.GetCurrentAsync().ConfigureAwait(true); model.UserId = meta.UserId; model.OfficeId = meta.OfficeId; model.LoginId = meta.LoginId; try { long tranId = await Receipts.PostAsync(this.Tenant, model).ConfigureAwait(true); return(this.Ok(tranId)); } catch (Exception ex) { return(this.Failed(ex.Message, HttpStatusCode.InternalServerError)); } }