예제 #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ModuleId,Title,Coordinator,Semester,Year,Department,Credits,Welsh,Url")] Module @module)
        {
            if (id != @module.ModuleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@module);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ModuleExists(@module.ModuleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@module));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SchemeModuleId,SchemeId,ModuleId,ModuleType")] SchemeModule schemeModule)
        {
            if (id != schemeModule.SchemeModuleId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(schemeModule);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchemeModuleExists(schemeModule.SchemeModuleId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ModuleId"] = new SelectList(_context.Modules, "ModuleId", "ModuleId", schemeModule.ModuleId);
            ViewData["SchemeId"] = new SelectList(_context.Schemes, "SchemeId", "SchemeId", schemeModule.SchemeId);
            return(View(schemeModule));
        }
예제 #3
0
        public async Task <IActionResult> Edit(string id, [Bind("SchemeId,Title,Award,Department,UndergraduateOrPostgraduate,SchemeType,Year,Duration,Url")] Scheme scheme)
        {
            if (id != scheme.SchemeId)
            {
                return(NotFound());
            }

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