public async Task <short> PutStateRepository(int _id, State _state)
        {
            if (_id != _state.Id)
            {
                return(1); //bad request
            }

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

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StateExists(_id))
                {
                    return(2); //not found
                }
                else
                {
                    throw;
                }
            }

            return(3); //no content
        }
 public ActionResult Grabar(int id, Evento evento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(evento).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (DbUpdateConcurrencyException)  // TODO: Manejar el error
         {
             if (!EventoExists(id))
             {
                 //return NotFound();
             }
             else
             {
                 throw;
             }
         }
         return(new JsonNetResult {
             Data = evento, Formatting = Formatting.None
         });
     }
     return(null);
 }