- [HttpPost]
- public ActionResult AddVolunteer(VolunteerInfo viewModel)
- {
- if (!ModelState.IsValid)
- {
- return View("AddVolunteer", viewModel);
- }
- var volunteer = new VolunteerInfo()
- {
- Name = viewModel.Name,
- DonationForWhom = DonationValue() //Here's the error. Expecting a parameter
- };
- _context.VolunteerInfos.Add(volunteer);
- _context.SaveChanges();
- return RedirectToAction("Index", "Home");
- }
- public string DonationValue(string name)
- {
- return name; //not sure how to pass this above
- }
Return value from function to ActionMethod in controller
The error is in the 12th line: There is no argument given that corresponds to the required formal parameter 'name' of 'VolunteerInfoController.DonationValue(string)' VMS.
I don't know how to correct this. Please help me
Ruchi SharavatPosted Jul 23, 2018, 1:50 AM
Anan SrivastavaPosted Jul 20, 2018, 9:48 AM
Ruchi SharavatPosted Jul 20, 2018, 5:48 AM
Anan SrivastavaPosted Jul 20, 2018, 4:56 AM
Jenith ThakkarPosted Jul 20, 2018, 4:41 AM
Anan SrivastavaPosted Jul 20, 2018, 4:37 AM
Jenith ThakkarPosted Jul 20, 2018, 4:11 AM
Anan SrivastavaPosted Jul 20, 2018, 2:55 AM
Jenith ThakkarPosted Jul 20, 2018, 2:49 AM
Anan SrivastavaPosted Jul 20, 2018, 2:47 AM
Anan SrivastavaPosted Jul 20, 2018, 2:39 AM
Jenith ThakkarPosted Jul 20, 2018, 2:37 AM
Anan SrivastavaPosted Jul 20, 2018, 2:32 AM
Jenith ThakkarPosted Jul 20, 2018, 2:22 AM