Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 5
0
 public void CommitAsync()
 {
     dataContext.SaveChangesAsync();
 }