Exemplo n.º 1
0
        public async Task <IHttpActionResult> PostElecSpindlePara(ElecSpindlePara elecSpindlePara)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ElecSpindleParas.Add(elecSpindlePara);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ElecSpindleParaExists(elecSpindlePara.TypeID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = elecSpindlePara.TypeID }, elecSpindlePara));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> PutElecSpindlePara(string id, ElecSpindlePara elecSpindlePara)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != elecSpindlePara.TypeID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetElecSpindlePara(string id)
        {
            ElecSpindlePara elecSpindlePara = await db.ElecSpindleParas.FindAsync(id);

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

            return(Ok(elecSpindlePara));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> DeleteElecSpindlePara(string id)
        {
            ElecSpindlePara elecSpindlePara = await db.ElecSpindleParas.FindAsync(id);

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

            db.ElecSpindleParas.Remove(elecSpindlePara);
            await db.SaveChangesAsync();

            return(Ok(elecSpindlePara));
        }