[ProducesResponseType(StatusCodes.Status500InternalServerError)] // if something unexpectedly went wrong with the database or http request/response public async Task <IActionResult> PutPlanProLabels(int id, Furs2Feathers.Domain.Models.PlanProLabels planProLabels) { if (id != planProLabels.PlanProLabelsId) { return(BadRequest()); } /*_context.Entry(planProLabels).State = EntityState.Modified;*/ if (!await planProLabelsRepo.ModifyStateAsync(planProLabels, 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.PlanProLabels> > PostPlanProLabels(Furs2Feathers.Domain.Models.PlanProLabels planProLabels) { planProLabelsRepo.Add(planProLabels); await planProLabelsRepo.SaveChangesAsync(); return(CreatedAtAction("GetPlanProLabels", new { id = planProLabels.PlanProLabelsId }, planProLabels)); }