Example #1
0
        public async Task <IActionResult> Edit(long id, [Bind("PropName,Id")] ThematicProp thematicProp)
        {
            if (id != thematicProp.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(thematicProp);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ThematicPropExists(thematicProp.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(thematicProp));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("PropName,Id")] ThematicProp thematicProp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(thematicProp);
                await _context.SaveChangesAsync();

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