public async Task <IActionResult> PostMapCompanyMagazineAd([FromBody] MapCompanyMagazineAd mapCompanyMagazineAd)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.MapCompanyMagazineAd.Add(mapCompanyMagazineAd);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMapCompanyMagazineAd", new { id = mapCompanyMagazineAd.CompMagId }, mapCompanyMagazineAd));
        }
        public async Task <IActionResult> PutMapCompanyMagazineAd([FromRoute] int id, [FromBody] MapCompanyMagazineAd mapCompanyMagazineAd)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mapCompanyMagazineAd.CompMagId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }