public async Task <ActionResult <CommandsV1> > PostCommands(CommandsV1 commands) { _context.Commands.Add(commands); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCommands", new { id = commands.Id }, commands)); }
public async Task <ActionResult <ResourcesV1> > PostResources(ResourcesV1 resources) { _context.Resources.Add(resources); await _context.SaveChangesAsync(); return(CreatedAtAction("GetResources", new { id = resources.Id }, resources)); }
public async Task <ActionResult <ProblemsV1> > PostProblems(ProblemsV1 problems) { _context.Problems.Add(problems); await _context.SaveChangesAsync(); return(CreatedAtAction("GetProblems", new { id = problems.Id }, problems)); }
public async Task <ActionResult <ExercisesV1> > PostExercises(ExercisesV1 exercises) { try { _context.Exercises.Add(exercises); await _context.SaveChangesAsync(); } catch (Exception e) { return(BadRequest(e)); } return(CreatedAtAction("GetExercises", new { id = exercises.Id }, exercises)); }