Exemplo n.º 1
0
        [ProducesResponseType(StatusCodes.Status500InternalServerError)] // if something unexpectedly went wrong with the database or http request/response
        public async Task <IActionResult> PutPlan(int id, Furs2Feathers.Domain.Models.Plan plan)
        {
            if (id != plan.PlanId)
            {
                return(BadRequest());
            }

            /*_context.Entry(plan).State = EntityState.Modified;*/
            if (!await planRepo.ModifyStateAsync(plan, id))
            {
                return(NotFound());
                // if false, then modifying state failed
            }
            else
            {
                return(NoContent());
                // successful put
            }
        }
Exemplo n.º 2
0
        [ProducesResponseType(StatusCodes.Status500InternalServerError)]                               // if something unexpectedly went wrong with the database or http request/response
        public async Task <ActionResult <Furs2Feathers.Domain.Models.Plan> > PostPlan(Furs2Feathers.Domain.Models.Plan plan)
        {
            planRepo.Add(plan);
            await planRepo.SaveChangesAsync();

            return(CreatedAtAction("GetPlan", new { id = plan.PlanId }, plan));
        }