Esempio n. 1
0
        public async Task <ActionResult <AppTestModel> > PostAppTestModel(AppTestModel appTestModel)
        {
            _context.AppTestModel.Add(appTestModel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAppTestModel", new { id = appTestModel.Id }, appTestModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,AppTestInput")] AppTestModel appTestModel)
        {
            if (id != appTestModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appTestModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppTestModelExists(appTestModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(appTestModel));
        }
Esempio n. 3
0
        public async Task <IActionResult> PutAppTestModel(int id, AppTestModel appTestModel)
        {
            if (id != appTestModel.Id)
            {
                return(BadRequest());
            }

            _context.Entry(appTestModel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AppTestModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("Id,AppTestInput")] AppTestModel appTestModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appTestModel);
                await _context.SaveChangesAsync();

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