Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("idType,maladie")] MvcType.Models.Type @type)
        {
            if (id != @type.idType)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@type);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TypeExists(@type.idType))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(@type));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("idType,maladie")] MvcType.Models.Type @type)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@type);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(@type));
        }