public async Task <IActionResult> WithdrawFunds(AddFundsViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.GetUserAsync(User); if (user == null) { await _signInManager.SignOutAsync(); return(RedirectToAction("Index", "Home", new { area = "" })); } var ouruser = user.Id; await _users.WithdrawFundsAsync(ouruser, model.Amount); return(RedirectToAction(nameof(WithdrawFunds))); }
public async Task <IActionResult> ChangeJobStatus(int id) { var user = await _userManager.GetUserAsync(User); var jobapp = _jobapps.GetById(id); if (user.Currency < jobapp.MyPrice) { return(RedirectToAction("AddFunds", "Manage")); } var job = _jobs.GetById(jobapp.JobId); var jobappuser = jobapp.AppliedBy; _jobs.SetEmployer(jobapp.JobId, jobapp.AppliedBy); _jobs.SetPrice(jobapp.JobId, jobapp.MyPrice); _jobapps.SetInProgress(id); var ouruser = _users.GetById(user.Id); await _users.WithdrawFundsAsync(user.Id, jobapp.MyPrice); return(RedirectToAction("JobInProgress", new { id = jobapp.JobId })); }