public IActionResult Create([FromBody] WorkoutProgram program) { _context.WorkoutPrograms.Add(program); _context.SaveChanges(); return(CreatedAtRoute("GetProgram", new { name = program.Name }, program)); }
public TEntity Add(TEntity entity, bool saveChanges = false) { entity.CreatedDateTime = DateTime.Now.ToUniversalTime(); _context.Add <TEntity>(entity); if (saveChanges) { _context.SaveChanges(); //Save(); } return(entity); }