public ActionResult _GetReceiveCollectionVMasJson(int customerId) { var recieveCollectionVM = new ReceiveCollectionsVM { CustomerId = customerId, PreferredPaymentSourceId = _customerAccountService.GetAccount(customerId).Customer.PreferredPaymentSourceId, Collections = MapToCollectionsVM(GetRolledTransactions(customerId)).ToList() }; return(Json(recieveCollectionVM, JsonRequestBehavior.AllowGet)); }
public ActionResult _ReceiveCollections(ReceiveCollectionsVM mReceiveCollectionsVM) { try { var collectionsWithPayments = mReceiveCollectionsVM.Collections.Where(c => c.Payment != 0); foreach (var collection in collectionsWithPayments) { _accountTransactionService.AddAccountTransaction(collection.CustomerAccountId, (AccountTransactionType)collection.AccountTransactionType, -(decimal)collection.Payment, AccountTransactionInputType.Payment, collection.GroupId, collection.Note); } _accountTransactionService.CommitChanges(); return(ReturnJsonFormSuccess()); } catch (Exception ex) { return(ReturnJsonError(ex.Message)); } }