public async Task <IActionResult> PutOffersGallery([FromRoute] int id, [FromBody] OffersGallery offersGallery) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != offersGallery.Id) { return(BadRequest()); } _context.Entry(offersGallery).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OffersGalleryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostOffersGallery([FromBody] OffersGallery offersGallery) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.OffersGalleries.Add(offersGallery); await _context.SaveChangesAsync(); return(CreatedAtAction("GetOffersGallery", new { id = offersGallery.Id }, offersGallery)); }