// GET: Default public ActionResult Home() { VolunteerApplicationVM volunteerApplication = new VolunteerApplicationVM(); ViewBag.GenderList = LoadGenderDDl(); return(View(volunteerApplication)); }
public bool AddVolunteer(VolunteerApplicationVM volunteerApplication) { bool isSuccess = false; if (volunteerApplication != null) { Volunteers_Application volunteers_Application = new Volunteers_Application(); volunteers_Application.City = volunteerApplication.City; volunteers_Application.Email = volunteerApplication.Email; volunteers_Application.Gender = volunteerApplication.Gender; volunteers_Application.MessageDescription = volunteerApplication.MessageDescription; volunteers_Application.Name = volunteerApplication.Name; try { _dbContext.Volunteers_Application.Add(volunteers_Application); _dbContext.SaveChanges(); isSuccess = true; } catch (Exception ex) { isSuccess = false; } } return(isSuccess); }
public ActionResult PostVolunteerData(VolunteerApplicationVM volunteerApplication) { if (ModelState.IsValid) { _accountRepo.AddVolunteer(volunteerApplication); } return(View("Home")); }