Ejemplo n.º 1
0
        public async Task <IHttpActionResult> PuttOrderType(int id, tOrderType OrderType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> GettOrderType(int id)
        {
            tOrderType tOrderType = await db.tOrderTypes.FindAsync(id);

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

            return(Ok(tOrderType));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> PosttOrderType(tOrderType OrderType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tOrderTypes.Add(OrderType);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = OrderType.ID }, OrderType));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> DeletetOrderType(int id)
        {
            tOrderType tOrderType = await db.tOrderTypes.FindAsync(id);

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

            db.tOrderTypes.Remove(tOrderType);
            await db.SaveChangesAsync();

            return(Ok(tOrderType));
        }