[ProducesResponseType(StatusCodes.Status500InternalServerError)] // if something unexpectedly went wrong with the database or http request/response public async Task <IActionResult> PutPlanReviews(int id, Furs2Feathers.Domain.Models.PlanReviews planReviews) { if (id != planReviews.PlanReviewId) { return(BadRequest()); } /*_context.Entry(planReviews).State = EntityState.Modified;*/ if (!await planReviewsRepo.ModifyStateAsync(planReviews, id)) { return(NotFound()); // if false, then modifying state failed } else { return(NoContent()); // successful put } }
[ProducesResponseType(StatusCodes.Status500InternalServerError)] // if something unexpectedly went wrong with the database or http request/response public async Task <ActionResult <Furs2Feathers.Domain.Models.PlanReviews> > PostPlanReviews(Furs2Feathers.Domain.Models.PlanReviews planReviews) { planReviewsRepo.Add(planReviews); await planReviewsRepo.SaveChangesAsync(); return(CreatedAtAction("GetPlanReviews", new { id = planReviews.PlanReviewId }, planReviews)); }