Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Name,Id")] Skill skill)
        {
            if (id != skill.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(skill);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SkillExists(skill.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(skill));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("FirstName,LastName,OrganizationId,Id")] Person person)
        {
            if (id != person.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(person);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonExists(person.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["OrganizationId"] = new SelectList(_context.Set <Organization>(), "Id", "Name", person.OrganizationId);
            return(View(person));
        }