// POST: odata/mdVoltageTransformers
        public async Task <IHttpActionResult> Post(mdVoltageTransformer mdVoltageTransformer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.mdVoltageTransformers.Add(mdVoltageTransformer);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (mdVoltageTransformerExists(mdVoltageTransformer.PrimaryEquipmentId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created(mdVoltageTransformer));
        }
        // DELETE: odata/mdVoltageTransformers(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            mdVoltageTransformer mdVoltageTransformer = await db.mdVoltageTransformers.FindAsync(key);

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

            db.mdVoltageTransformers.Remove(mdVoltageTransformer);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
        // PUT: odata/mdVoltageTransformers(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <mdVoltageTransformer> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            mdVoltageTransformer mdVoltageTransformer = await db.mdVoltageTransformers.FindAsync(key);

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

            patch.Put(mdVoltageTransformer);

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

            return(Updated(mdVoltageTransformer));
        }