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

            db.msSubstationStructures.Add(msSubstationStructure);
            await db.SaveChangesAsync();

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

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

            db.msSubstationStructures.Remove(msSubstationStructure);
            await db.SaveChangesAsync();

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

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

            msSubstationStructure msSubstationStructure = await db.msSubstationStructures.FindAsync(key);

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

            patch.Put(msSubstationStructure);

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

            return(Updated(msSubstationStructure));
        }