示例#1
0
        public async Task <IHttpActionResult> PutMotClefCategorie(int id, MotClefCategorie motClefCategorie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#2
0
        public async Task <IHttpActionResult> GetMotClefCategorie(int id)
        {
            MotClefCategorie motClefCategorie = await db.MotClefCategorie.FindAsync(id);

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

            return(Ok(motClefCategorie));
        }
示例#3
0
        public async Task <IHttpActionResult> PostMotClefCategorie(MotClefCategorie motClefCategorie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MotClefCategorie.Add(motClefCategorie);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = motClefCategorie.IdMotClefCategorie }, motClefCategorie));
        }
示例#4
0
        public async Task <IHttpActionResult> DeleteMotClefCategorie(int id)
        {
            MotClefCategorie motClefCategorie = await db.MotClefCategorie.FindAsync(id);

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

            db.MotClefCategorie.Remove(motClefCategorie);
            await db.SaveChangesAsync();

            return(Ok(motClefCategorie));
        }