Пример #1
0
        public IHttpActionResult PostEmployment_details(Employment_details employment_details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Employment_details.Add(employment_details);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (Employment_detailsExists(employment_details.email))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = employment_details.email }, employment_details));
        }
Пример #2
0
        public IHttpActionResult PutEmployment_details(string id, Employment_details employment_details)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult GetEmployment_details(string id)
        {
            Employment_details employment_details = db.Employment_details.Find(id);

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

            return(Ok(employment_details));
        }
Пример #4
0
        public IHttpActionResult DeleteEmployment_details(string id)
        {
            Employment_details employment_details = db.Employment_details.Find(id);

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

            db.Employment_details.Remove(employment_details);
            db.SaveChanges();

            return(Ok(employment_details));
        }