예제 #1
0
        public async Task <IHttpActionResult> PutDepopulation_Batch(int id, Depopulation_Batch depopulation_Batch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != depopulation_Batch.did)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
        public async Task <IHttpActionResult> GetDepopulation_Batch(int id)
        {
            Depopulation_Batch depopulation_Batch = await db.Depopulation_Batch.FindAsync(id);

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

            return(Ok(depopulation_Batch));
        }
예제 #3
0
        public async Task <IHttpActionResult> PostDepopulation_Batch(Depopulation_Batch depopulation_Batch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Depopulation_Batch.Add(depopulation_Batch);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = depopulation_Batch.did }, depopulation_Batch));
        }
예제 #4
0
        public async Task <IHttpActionResult> DeleteDepopulation_Batch(int id)
        {
            Depopulation_Batch depopulation_Batch = await db.Depopulation_Batch.FindAsync(id);

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

            db.Depopulation_Batch.Remove(depopulation_Batch);
            await db.SaveChangesAsync();

            return(Ok(depopulation_Batch));
        }