Beispiel #1
0
        public async Task <IHttpActionResult> PostPMSrvMotorPara(PMSrvMotorPara pMSrvMotorPara)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PMSrvMotorParas.Add(pMSrvMotorPara);

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

            return(CreatedAtRoute("DefaultApi", new { id = pMSrvMotorPara.TypeID }, pMSrvMotorPara));
        }
Beispiel #2
0
        public async Task <IHttpActionResult> PutPMSrvMotorPara(string id, PMSrvMotorPara pMSrvMotorPara)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> GetPMSrvMotorPara(string id)
        {
            PMSrvMotorPara pMSrvMotorPara = await db.PMSrvMotorParas.FindAsync(id);

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

            return(Ok(pMSrvMotorPara));
        }
Beispiel #4
0
        public async Task <IHttpActionResult> DeletePMSrvMotorPara(string id)
        {
            PMSrvMotorPara pMSrvMotorPara = await db.PMSrvMotorParas.FindAsync(id);

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

            db.PMSrvMotorParas.Remove(pMSrvMotorPara);
            await db.SaveChangesAsync();

            return(Ok(pMSrvMotorPara));
        }