Exemplo n.º 1
0
        public async Task <IActionResult> PutWords([FromRoute] int id, [FromBody] Words words)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != words.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "id,homeText,foreignText,description")] Word word)
 {
     if (ModelState.IsValid)
     {
         wordcontext.Entry(word).State = EntityState.Modified;
         wordcontext.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(word));
 }