Exemplo n.º 1
0
        public IHttpActionResult PostLDAP_AD_USERS(LDAP_AD_USERS lDAP_AD_USERS)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.LDAP_AD_USERS.Add(lDAP_AD_USERS);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (LDAP_AD_USERSExists(lDAP_AD_USERS.ImportDateTime))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = lDAP_AD_USERS.ImportDateTime }, lDAP_AD_USERS);
        }
Exemplo n.º 2
0
        public IHttpActionResult PutLDAP_AD_USERS(DateTime id, LDAP_AD_USERS lDAP_AD_USERS)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }