public async Task UpdateTransaction(PutMoney putMoney, decimal amount) { putMoney.Used = true; putMoney.Money = amount; _putMoneyRepository.Update(putMoney); await _putMoneyRepository.Save(); }
private async Task DeactivateItem(PutMoney item) { if (item.Date.AddDays(30).Date == DateTime.Now.Date) { item.Active = true; _putMoneyRepository.Update(item); await _putMoneyRepository.Save(); } }
public void PutMoney(Account acc, double sum) { ITransaction transaction = new PutMoney(acc, sum); var res = transaction.Execute(); if (res) { _history.Push(transaction); } }
public async Task Callback(string secret, string input_address, string value) { if (secret == "zyrafywchodzodoszafy") { //TODO: OPTIMIZE PutMoney putMoney = _putMoneyRepository.GetAll().Where(a => a.Email == input_address).Last(); ApplicationUser user = await _userManager.FindByIdAsync(putMoney.UserId); // Update transaction - set as used await _paymentsService.UpdateTransaction(putMoney, decimal.Parse(value, CultureInfo.InvariantCulture)); // Add lead and update money await _paymentsService.UpdateUserData(user, decimal.Parse(value, CultureInfo.InvariantCulture)); } }
public async Task <string> PutMoney(HttpContext httpContext, PutMoneyViewModel model) { var user = await _userManager.GetUserAsync(httpContext.User); PutMoney putMoney = _putMoneyMapper.ViewModelToEntity(new PutMoney(), model); putMoney.Used = false; putMoney.UserId = user.Id; putMoney.Date = DateTime.Now; dynamic result = await GetJsonDataFromUrl(); putMoney.Email = result.input_address; _putMoneyRepository.Insert(putMoney); await _putMoneyRepository.Save(); return(result.input_address); }