public IHttpActionResult PutExperience(int id, ExperienceDTO experience)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            try
            {
                db.Create(experience);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExperienceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult PostExperience(ExperienceDTO experience)
        {
            //experience = new ExperienceDTO();
            //experience.BusinessID = 18;
            //experience.JobPossition = "Software Developer";
            //experience.UserID = 50;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var objExprience = db.Create(experience);

            return(CreatedAtRoute("DefaultApi", new { id = experience.ExperienceID }, objExprience));
        }