Пример #1
0
        public async Task <IHttpActionResult> PutInnerInstitutionCollection(int id, InnerInstitutionCollection innerInstitutionCollection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != innerInstitutionCollection.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public async Task <IHttpActionResult> GetInnerInstitutionCollection(int id)
        {
            InnerInstitutionCollection innerInstitutionCollection = await db.InnerInstitutionCollections.FindAsync(id);

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

            return(Ok(innerInstitutionCollection));
        }
Пример #3
0
        public async Task <IHttpActionResult> PostInnerInstitutionCollection(InnerInstitutionCollection innerInstitutionCollection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.InnerInstitutionCollections.Add(innerInstitutionCollection);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = innerInstitutionCollection.Id }, innerInstitutionCollection));
        }
Пример #4
0
        public async Task <IHttpActionResult> DeleteInnerInstitutionCollection(int id)
        {
            InnerInstitutionCollection innerInstitutionCollection = await db.InnerInstitutionCollections.FindAsync(id);

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

            db.InnerInstitutionCollections.Remove(innerInstitutionCollection);
            await db.SaveChangesAsync();

            return(Ok(innerInstitutionCollection));
        }