Beispiel #1
0
        public async Task <IHttpActionResult> PutNG2_Cars(int id, NG2_Cars nG2_Cars)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> GetNG2_Cars(int id)
        {
            NG2_Cars nG2_Cars = await db.NG2_Cars.FindAsync(id);

            if (nG2_Cars == null)
            {
                return(NotFound());
            }

            return(Ok(nG2_Cars));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> PostNG2_Cars(NG2_Cars nG2_Cars)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NG2_Cars.Add(nG2_Cars);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = nG2_Cars.id }, nG2_Cars));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeleteNG2_Cars(int id)
        {
            NG2_Cars nG2_Cars = await db.NG2_Cars.FindAsync(id);

            if (nG2_Cars == null)
            {
                return(NotFound());
            }

            db.NG2_Cars.Remove(nG2_Cars);
            await db.SaveChangesAsync();

            return(Ok(nG2_Cars));
        }