示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ResourceId,Type,Available,Location,CertificationLevel,VehicleType")] Resource resource)
        {
            if (id != resource.ResourceId)
            {
                return(NotFound());
            }

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