Exemplo n.º 1
0
        public async Task <IActionResult> PostSrvDriverTransformer([FromBody] SrvDriverTransformer srvDriverTransformer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SrvDriverTransformers.Add(srvDriverTransformer);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (SrvDriverTransformerExists(srvDriverTransformer.TypeID))
                {
                    return(StatusCode((int)HttpStatusCode.Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = srvDriverTransformer.TypeID }, srvDriverTransformer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutSrvDriverTransformer(string id, [FromBody] SrvDriverTransformer srvDriverTransformer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode((int)HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> GetSrvDriverTransformer(string id)
        {
            SrvDriverTransformer srvDriverTransformer = await db.SrvDriverTransformers.FindAsync(id);

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

            return(Ok(srvDriverTransformer));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> DeleteSrvDriverTransformer(string id)
        {
            SrvDriverTransformer srvDriverTransformer = await db.SrvDriverTransformers.FindAsync(id);

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

            db.SrvDriverTransformers.Remove(srvDriverTransformer);
            await db.SaveChangesAsync();

            return(Ok(srvDriverTransformer));
        }