public async Task <IActionResult> PostCostCenterByItemFamily([FromBody] CostCenterByItemFamily costCenterByItemFamily)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.CostCenterByItemFamilies.Add(costCenterByItemFamily);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCostCenterByItemFamily", new { id = costCenterByItemFamily.Id }, costCenterByItemFamily));
        }
        public async Task <IActionResult> PutCostCenterByItemFamily([FromRoute] int id, [FromBody] CostCenterByItemFamily costCenterByItemFamily)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != costCenterByItemFamily.Id)
            {
                return(BadRequest());
            }

            _context.Entry(costCenterByItemFamily).State = EntityState.Modified;

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

            return(Ok(_context.CostCenterByItemFamilies.Find(id)));
        }