public async Task <IActionResult> PutMstMagazineAd([FromRoute] int id, [FromBody] MstMagazineAd mstMagazineAd) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mstMagazineAd.MagazineAdId) { return(BadRequest()); } _context.Entry(mstMagazineAd).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MstMagazineAdExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMstMagazineAd([FromBody] MstMagazineAd mstMagazineAd) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MstMagazineAd.Add(mstMagazineAd); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMstMagazineAd", new { id = mstMagazineAd.MagazineAdId }, mstMagazineAd)); }