public async Task <IActionResult> PutCategorieCommercant(int id, CategorieCommercant categorieCommercant) { if (id != categorieCommercant.CommercantId) { return(BadRequest()); } _context.Entry(categorieCommercant).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategorieCommercantExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <CategorieCommercant> > PostCategorieCommercant(CategorieCommercant categorieCommercant) { _context.CategorieCommercants.Add(categorieCommercant); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (CategorieCommercantExists(categorieCommercant.CommercantId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetCategorieCommercant", new { id = categorieCommercant.CommercantId }, categorieCommercant)); }