Beispiel #1
0
        public async Task <IHttpActionResult> PuttMedicationRoute(int id, tMedicationRoute MedicationRoute)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != MedicationRoute.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> GettMedicationRoute(int id)
        {
            tMedicationRoute tMedicationRoute = await db.tMedicationRoutes.FindAsync(id);

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

            return(Ok(tMedicationRoute));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> PosttMedicationRoute(tMedicationRoute MedicationRoute)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tMedicationRoutes.Add(MedicationRoute);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = MedicationRoute.ID }, MedicationRoute));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeletetMedicationRoute(int id)
        {
            tMedicationRoute tMedicationRoute = await db.tMedicationRoutes.FindAsync(id);

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

            db.tMedicationRoutes.Remove(tMedicationRoute);
            await db.SaveChangesAsync();

            return(Ok(tMedicationRoute));
        }