コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,name,yearsexperience,ASTACertified,Specialties,PlacesVisited,email,DateCreated,DateLastModified")] TravelAgentParameters travelAgentParameters)
        {
            if (id != travelAgentParameters.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(travelAgentParameters);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TravelAgentParametersExists(travelAgentParameters.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(travelAgentParameters));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("ID,name,yearsexperience,ASTACertified,Specialties,PlacesVisited,email,DateCreated,DateLastModified")] TravelAgentParameters travelAgentParameters)
        {
            if (ModelState.IsValid)
            {
                _context.Add(travelAgentParameters);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(travelAgentParameters));
        }