public async Task <IActionResult> Create([Bind("VKey,Name,NickName,Age,Ethnicity,Email,PhoneNumber")] Volunteer volunteer) { if (ModelState.IsValid) { _context.Add(volunteer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(volunteer)); }
public async Task <IActionResult> SaveVolunteer([Bind("Name,NicName,Age,Ethnicity,Email,PhoneNumber")] Volunteer volunteer) { if (ModelState.IsValid) { _context.Add(volunteer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(VolunteerSaveSuccess))); } return(View()); }
public IActionResult Delete(int id) { var listingToDelete = db.Listings.Find(id); if (listingToDelete == null) { return(NotFound()); } db.Listings.Remove(listingToDelete); db.SaveChangesAsync(); return(NoContent()); }
public IActionResult Delete(int id) { var accountToDelete = db.Accounts.Find(id); if (accountToDelete == null) { return(NotFound()); } db.Accounts.Remove(accountToDelete); db.SaveChangesAsync(); return(NoContent()); }
public void CommitAsync() { dataContext.SaveChangesAsync(); }