Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,Term,Definition")] GlossaryItem glossary)
        {
            if (id != glossary.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    ;
                    await _glossaryService.Update(glossary);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!_glossaryService.Exists(glossary.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(glossary));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <GlossaryModel> > Update([FromBody] GlossaryModel model)
        {
            var savedModel = await _service.Update(model);

            return(Ok(savedModel));
        }