public async Task <ActionResult <SwithingPlan> > PostSwithingPlan(SwithingPlan swithingPlan) { _context.SwithingPlan.Add(swithingPlan); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSwithingPlan", new { id = swithingPlan.id }, swithingPlan)); }
public async Task <IActionResult> PutSwithingPlan(int id, SwithingPlan swithingPlan) { if (id != swithingPlan.id) { return(BadRequest()); } _context.Entry(swithingPlan).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SwithingPlanExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }