public async Task <IActionResult> PostFeatureRequestItem([FromBody] FeatureRequestItem featureRequestItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.FeatureRequestItem.Add(featureRequestItem); await _context.SaveChangesAsync(); return(CreatedAtAction("GetFeatureRequestItem", new { id = featureRequestItem.Id }, featureRequestItem)); }
public async Task <IActionResult> PutFeatureRequestItem([FromRoute] string id, [FromBody] FeatureRequestItem featureRequestItem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != featureRequestItem.Id) { return(BadRequest()); } _context.Entry(featureRequestItem).State = EntityState.Modified; try { featureRequestItem.LastEditDate = DateTime.Now; await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeatureRequestItemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }