public IHttpActionResult PutspecNutrition(int id, specNutrition specNutrition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PostspecNutrition(specNutrition specNutrition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.specNutrition.Add(specNutrition);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = specNutrition.idSpecN }, specNutrition));
        }
        public IHttpActionResult DeletespecNutrition(int id)
        {
            specNutrition specNutrition = db.specNutrition.Find(id);

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

            db.specNutrition.Remove(specNutrition);
            db.SaveChanges();

            return(Ok(specNutrition));
        }
        public IHttpActionResult GetspecNutrition(int id)
        {
            specNutrition          specNutrition = db.specNutrition.Find(id);
            SpecNutritionViewModel Cvm           = new SpecNutritionViewModel();

            if (specNutrition == null)
            {
                return(NotFound());
            }
            else
            {
                Cvm.idSpecN  = specNutrition.idSpecN;
                Cvm.nom      = specNutrition.nom;
                Cvm.prenom   = specNutrition.prenom;
                Cvm.username = specNutrition.username;
                Cvm.password = specNutrition.password;
                Cvm.email    = specNutrition.email;
                Cvm.photo    = specNutrition.photo;
                Cvm.bio      = specNutrition.bio;
            }

            return(Ok(Cvm));
        }