public async Task <IHttpActionResult> PutCostCenter_ServiceLine(int id, CostCenter_ServiceLine costCenter_ServiceLine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != costCenter_ServiceLine.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GetCostCenter_ServiceLine(int id)
        {
            CostCenter_ServiceLine costCenter_ServiceLine = await db.CostCenter_ServiceLine.FindAsync(id);

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

            return(Ok(costCenter_ServiceLine));
        }
        public async Task <IHttpActionResult> DeleteCostCenter_ServiceLine(int id)
        {
            CostCenter_ServiceLine costCenter_ServiceLine = await db.CostCenter_ServiceLine.FindAsync(id);

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

            costCenter_ServiceLine.IsDeleted = true;
            await db.SaveChangesAsync();

            return(Ok(costCenter_ServiceLine));
        }
        public async Task <IHttpActionResult> PostCostCenter_ServiceLine(CostCenter_ServiceLine costCenter_ServiceLine)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CostCenter_ServiceLine.Add(costCenter_ServiceLine);
            await db.SaveChangesAsync();

            costCenter_ServiceLine.ServiceLine = db.ServiceLines.SingleOrDefault(s => s.ID == costCenter_ServiceLine.FK_ServiceLine);
            costCenter_ServiceLine.CostCenter  = db.CostCenters.SingleOrDefault(s => s.ID == costCenter_ServiceLine.FK_CostCenter);

            return(CreatedAtRoute("DefaultApi", new { id = costCenter_ServiceLine.ID }, costCenter_ServiceLine));
        }