public ActionResult Create([Bind(Include = "Id,SmallestAmount,LargestAmount,Fee")] MaintainanceFee maintainanceFee) { if (ModelState.IsValid) { db.MaintainanceFees.Add(maintainanceFee); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(maintainanceFee)); }
public ActionResult Create([Bind(Include = "Id,Name,Title,Description,Value")] CR_AccountType cR_AccountType) { if (ModelState.IsValid) { db.CR_AccountType.Add(cR_AccountType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cR_AccountType)); }
public ActionResult Create([Bind(Include = "Id,Name,ShortCode,CurrentValueToDollar")] CR_Currency cR_Currency) { if (ModelState.IsValid) { db.CR_Currency.Add(cR_Currency); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cR_Currency)); }
public ActionResult CreateAuthorizationCodes(CodesDto m) { inject(); if (ModelState.IsValid) { _context.TransactionCodes.Add(new TransactionCode { AccountNo = m.accountNo, COT = m.cto, IMF = m.imf, TAX = m.tax, Status = CodeStatus.UNUSED.ToString(), DateGenerated = DateTime.UtcNow }); _context.SaveChanges(); return(Json(new { status = 200, message = "Successful" })); } return(Json(new { status = 0, message = "Something went wrong with the server" })); //return View(m); }
public bool Create(VerificationVm m) { try { var save = context.CR_Verification.Add(new CR_Verification() { DocumentUrl = m.DocumentUrl, Status = VerificationStatus.PENDING.ToString(), VerificationType = m.VerificationType, CR_AccountId = m.CryptoAccountId }); context.SaveChanges(); savedAccountId = save.Id; return(true); } catch (Exception e) { return(true); } }
public bool CreateAccount(CryptoAccountVm m) { try { var save = context.CR_Account.Add(new CR_Account() { AccountTypeId = m.AccountTypeId, UserId = m.UserId, CurrencyId = m.CurrencyId, CurrentCryptoBalance = (decimal?)0.000000, Status = AccountStatus.PENDING.ToString(), DateCreated = DateTime.UtcNow }); context.SaveChanges(); savedAccountId = save.Id; return(true); } catch (Exception e) { return(true); } }
public bool Create(TransactionVm m) { try { var save = context.CR_Transactions.Add(new CR_Transactions() { Status = m.Status.ToString(), AccountId = m.accountId, Amount = m.Amount, TransactionType = m.TransactionType.ToString(), DateCreated = DateTime.UtcNow, }); context.SaveChanges(); savedId = save.Id; return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public bool Create(WithdrawVm m) { try { var s = context.WithdrawRequests.Add(new WithdrawRequest() { AccountId = m.AccountId, Status = WithDrawRequestStatus.Pending.ToString(), DateCreated = DateTime.UtcNow, Amount = Convert.ToDecimal(m.Amount), WalletId = m.WalletId, MaintainceFee = m.MaintainceFee, MaintainceFeeStatus = WithDrawRequestStatus.HasNotPaidMaintainceFee.ToString() }); context.SaveChanges(); savedId = s.Id; return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public ActionResult DeleteUser(string id) { var db = new mbankEntities();; //find Users var findUser = db.AspNetUsers.Find(id); if (findUser != null) { //Delete User db.AspNetUsers.Remove(findUser); db.SaveChanges(); return(Json(new { value = 200, message = "User Deleted" }, JsonRequestBehavior.AllowGet)); } return(Json(new { value = 0, message = "Something Went wrong" }, JsonRequestBehavior.AllowGet)); }
public bool Create(ActivityVm m) { try { var s = context.CR_Activity.Add(new CR_Activity() { AccountId = m.AccountId, Amount = m.Amount, DateCreated = DateTime.UtcNow }); context.SaveChanges(); savedAccountId = s.Id; return(true); } catch (Exception ex) { return(false); } }
public ActionResult Transfer(TransferDto m) { inject(); string userId = User.Identity.GetUserId(); accountNumber = new Services.Account().getAccountNumber(userId); var codes = _context.TransactionCodes.Where(a => a.AccountNo == accountNumber).FirstOrDefault(); //valid codes var accountService = new Services.Account(); var checkDes = accountService.FindAccount(m.destinationAccountNo); if (checkDes == true) { //save transaction //get balance var balance = Convert.ToDecimal(accountService.GetBalance(accountNumber)); if (balance >= m.amount) { var newBalance = balance - m.amount; accountService.UpdateAccountBalance(accountNumber, newBalance); _context.ForwardTransfers.Add(new ForwardTransfer { AccountID = m.accountNo, Amount = m.amount, BeneficaryAddress = m.address, BeneficaryBank = m.bBankName, BeneficaryName = m.bName, BeneficarySwiftCode = m.swiftCode, IBAN = m.iban, DestinationAccountNo = m.destinationAccountNo, Purpose = m.purpose, Status = Services.TransactionStatus.SUCCESSFUL.ToString(), Date = DateTime.UtcNow }); _context.SaveChanges(); var destinationAccountBalance = Convert.ToDecimal(accountService.GetBalance(m.destinationAccountNo)); var destnationNewBalance = destinationAccountBalance + m.amount; var updateDestinatationAccountBalance = accountService.UpdateAccountBalance(m.destinationAccountNo, destnationNewBalance); return(Json(new { status = 200, message = "Transaction Successful" })); } else { //Insufficent Fund return(Json(new { status = 0, message = "Insufficent Fund in account" })); } } else if (codes == null) { return(Json(new { status = 0, message = "Something went wrong please contact service provider " })); } else if (codes.COT == m.cot && codes.IMF == m.imf && codes.TAX == m.tax) { //check if destination account _context.ForwardTransfers.Add(new ForwardTransfer { AccountID = m.accountNo, Amount = m.amount, BeneficaryAddress = m.address, BeneficaryBank = m.bBankName, BeneficaryName = m.bName, BeneficarySwiftCode = m.swiftCode, IBAN = m.iban, DestinationAccountNo = m.destinationAccountNo, Purpose = m.purpose, Status = Services.TransactionStatus.PENDING.ToString(), Date = DateTime.UtcNow }); _context.SaveChanges(); //no account in system return(Json(new { status = 200, message = "Request has been sent, and its awaiting approval" })); } else { return(Json(new { status = 0, message = "Transaction Failed at this moment, Hope you entered the right infomations" })); } }
public ActionResult Callback(IPNModel callback) { bool valid_key = false; if (!string.IsNullOrEmpty(callback.private_key_hash) && callback.private_key_hash.Length == 128 && Regex.IsMatch(callback.private_key_hash, "[a-zA-Z0-9]+")) { string[] ss = ConfigurationManager.AppSettings["PrivateKeys"].Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); List <string> s = new List <string>(); foreach (string s1 in ss) { s.Add(Calculator.md512(s1)); } valid_key = s.Contains(callback.private_key_hash); } if (!string.IsNullOrEmpty(Request.Form["plugin_ver"]) && string.IsNullOrEmpty(callback.status) && valid_key) { return(new ContentResult() { Content = "cryptoboxver_asp_1.0" }); } if (callback.order == null) { callback.order = ""; } if (callback.user == null) { callback.user = ""; } if (callback.usercountry == null) { callback.usercountry = ""; } string box_status = "cryptobox_nochanges"; if (ModelState.IsValid) { int paymentId = 0; crypto_payments obj = Context.crypto_payments.FirstOrDefault(x => x.boxID == callback.box && x.orderID == callback.order && x.userID == callback.user && x.txID == callback.tx && x.amount == callback.amount && x.addr == callback.addr); if (obj == null) { crypto_payments newPayments = new crypto_payments() { boxID = callback.box, boxType = callback.boxtype, orderID = callback.order, userID = callback.user, countryID = callback.usercountry, coinLabel = callback.coinlabel, amount = callback.amount, amountUSD = callback.amountusd, unrecognised = (byte)(callback.status == "payment_received_unrecognised" ? 1 : 0), addr = callback.addr, txID = callback.tx, txDate = callback.datetime, txConfirmed = callback.confirmed, txCheckDate = DateTime.Now, recordCreated = DateTime.Now }; try { Context.crypto_payments.Add(newPayments); Context.SaveChanges(); paymentId = newPayments.paymentID; } catch (DbEntityValidationException dbEx) { var modelErrors2 = new List <string>(); foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { modelErrors2.Add("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage); } } return(new ContentResult() { Content = String.Join(", ", modelErrors2.ToArray()) }); } obj = newPayments; box_status = "cryptobox_newrecord"; } else if (callback.confirmed == 1 && obj.txConfirmed == 0) { obj.txConfirmed = 1; obj.txCheckDate = DateTime.Now; Context.SaveChanges(); paymentId = obj.paymentID; box_status = "cryptobox_updated"; } else { paymentId = obj.paymentID; } NewPayment.Main(paymentId, callback, box_status); return(new ContentResult() { Content = box_status }); } //for test var modelErrors = new List <string>(); foreach (ModelState err in ViewData.ModelState.Values) { foreach (ModelError error in err.Errors) { modelErrors.Add(error.ErrorMessage); } } return(new ContentResult() { Content = String.Join(", ", modelErrors.ToArray()) }); }