public async Task <IActionResult> PutFixedPriceType([FromRoute] int id, [FromBody] FixedPriceType fixedPriceType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != fixedPriceType.FixedPriceTypeId) { return(BadRequest()); } _context.Entry(fixedPriceType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FixedPriceTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostFixedPriceType([FromBody] FixedPriceType fixedPriceType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.FixedPriceTypes.Add(fixedPriceType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFixedPriceType", new { id = fixedPriceType.FixedPriceTypeId }, fixedPriceType)); }