public IHttpActionResult PutCursos(int id, Cursos cursos)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(cursos).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CursosExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
 public void Update(Employee record)
 {
     _db.Entry(record).State = EntityState.Modified;
     _db.SaveChanges();
 }