Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PhoneNumber,EmailAddress,Message,BeenHelped,EntryDate,ServiceRequested,Comments")] ContactClientModel contactClientModel)
        {
            if (id != contactClientModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contactClientModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContactClientModelExists(contactClientModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(contactClientModel));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Company,Message,DatePublished,Publish")] TestimonyModel testimonyModel)
        {
            if (id != testimonyModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testimonyModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestimonyModelExists(testimonyModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(testimonyModel));
        }