public IHttpActionResult PutPersonAdresse(int id, PersonAdresse personAdresse)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public IHttpActionResult PutByPostNummer(int id, ByPostNummer byPostNummer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public TEntity Update(int id, TEntity obj)
        {
            Context.Set <TEntity>().Attach(obj);
            Context.Entry(obj).State = EntityState.Modified;

            return(Context.Set <TEntity>().Find(id));
        }
        public IHttpActionResult PutTelefonNummer(int id, TelefonNummer telefonNummer)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }